Hey,
woran kann es liegen, das Cars nicht immer mit Tuning geladen werden?
Das ist das public dazu:
public CreateTunedCar(playerid)
{
if(IsPlayerConnected(playerid) && Carlist[playerid][Typ]!=-1)
{
new carid=CreateVehicle(Kaufliste[Carlist[playerid][Typ]][Modelid],Carlist[playerid][CarPos_x],Carlist[playerid][CarPos_y],Carlist[playerid][CarPos_z],Carlist[playerid][CarRotate],-1,-1,-1);
if(Carlist[playerid][Lock]==1 || Carlist[playerid][Lock]==0)
{
SetVehicleParamsForAll(carid,0,1);
SetVehicleParamsForPlayer(carid,playerid,0,1);
SetVehicleParamsForAll(Carlist[playerid][Carid],0,1);
Carlist[playerid][Lock]=1;
}
if(Carlist[playerid][mod1]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod1]); }
if(Carlist[playerid][mod2]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod2]); }
if(Carlist[playerid][mod3]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod3]); }
if(Carlist[playerid][mod4]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod4]); }
if(Carlist[playerid][mod5]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod5]); }
if(Carlist[playerid][mod6]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod6]); }
if(Carlist[playerid][mod7]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod7]); }
if(Carlist[playerid][mod8]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod8]); }
if(Carlist[playerid][mod9]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod9]); }
if(Carlist[playerid][mod10]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod10]); }
if(Carlist[playerid][mod11]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod11]); }
if(Carlist[playerid][mod12]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod12]); }
if(Carlist[playerid][mod13]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod13]); }
if(Carlist[playerid][mod14]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod14]); }
if(Carlist[playerid][mod15]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod15]); }
if(Carlist[playerid][mod16]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod16]); }
if(Carlist[playerid][mod17]!=-1) { AddVehicleComponent(carid,Carlist[playerid][mod17]); }
if(Carlist[playerid][Paintjob]!=-1) { ChangeVehiclePaintjob(carid,Carlist[playerid][Paintjob]); }
if(Carlist[playerid][Farbe1]!=-1) { ChangeVehicleColor(carid,Carlist[playerid][Farbe1],Carlist[playerid][Farbe2]); }
return carid;
}
return -1;
}
Das unter OnPlayerLogin:
public OnPlayerLogin(playerid,password[])
{
new dateiname[MAX_PLAYER_NAME+4];
new playername[MAX_PLAYER_NAME];
Carlist[playerid][Typ]=-1; Carlist[playerid][CarPos_x]=0.0; Carlist[playerid][CarPos_y]=0.0; Carlist[playerid][CarPos_z]=0.0;
Carlist[playerid][CarRotate]=0.0; Carlist[playerid][Status]=0; Carlist[playerid][Lock]=0; Carlist[playerid][Carid]=-1;
Carlist[playerid][Farbe1]=-1; Carlist[playerid][Farbe2]=-1; Carlist[playerid][mod1]=-1; Carlist[playerid][mod2]=-1;
Carlist[playerid][mod3]=-1; Carlist[playerid][mod4]=-1; Carlist[playerid][mod5]=-1; Carlist[playerid][mod6]=-1;
Carlist[playerid][mod7]=-1; Carlist[playerid][mod8]=-1; Carlist[playerid][mod9]=-1; Carlist[playerid][mod10]=-1;
Carlist[playerid][mod11]=-1; Carlist[playerid][mod12]=-1; Carlist[playerid][mod13]=-1; Carlist[playerid][mod14]=-1;
Carlist[playerid][mod15]=-1; Carlist[playerid][mod16]=-1; Carlist[playerid][mod17]=-1; Carlist[playerid][Paintjob]=-1;
Spectating[playerid][0]=-1;
bietetAn[playerid]={-1,0};
GetPlayerName(playerid, playername, sizeof(playername));
format(dateiname, sizeof(dateiname), "/fahrzeuge/%s.car", playername);
if (fexist(dateiname))
{
new File: CarFile = fopen(dateiname, io_read);
if ( CarFile )
{
new key[ 256 ];
new Data[ 256 ];
while ( fread( CarFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey(Data);
if(strcmp(key,"AH_Typ",true)==0) { Carlist[playerid][Typ]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_X",true)==0) { Carlist[playerid][CarPos_x]=floatstr(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Y",true)==0) { Carlist[playerid][CarPos_y]=floatstr(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Z",true)==0) { Carlist[playerid][CarPos_z]=floatstr(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Rot",true)==0) { Carlist[playerid][CarRotate]=floatstr(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Status",true)==0) { Carlist[playerid][Status]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Lock",true)==0) { Carlist[playerid][Lock]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Paintjob",true)==0) { Carlist[playerid][Paintjob]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Farbe1",true)==0) { Carlist[playerid][Farbe1]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_Farbe2",true)==0) { Carlist[playerid][Farbe2]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod1",true)==0) { Carlist[playerid][mod1]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod2",true)==0) { Carlist[playerid][mod2]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod3",true)==0) { Carlist[playerid][mod3]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod4",true)==0) { Carlist[playerid][mod4]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod5",true)==0) { Carlist[playerid][mod5]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod6",true)==0) { Carlist[playerid][mod6]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod7",true)==0) { Carlist[playerid][mod7]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod8",true)==0) { Carlist[playerid][mod8]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod9",true)==0) { Carlist[playerid][mod9]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod10",true)==0) { Carlist[playerid][mod10]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod11",true)==0) { Carlist[playerid][mod11]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod12",true)==0) { Carlist[playerid][mod12]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod13",true)==0) { Carlist[playerid][mod13]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod14",true)==0) { Carlist[playerid][mod14]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod15",true)==0) { Carlist[playerid][mod15]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod16",true)==0) { Carlist[playerid][mod16]=strval(ini_GetValue(Data)); }
else if(strcmp(key,"AH_mod17",true)==0) { Carlist[playerid][mod17]=strval(ini_GetValue(Data)); }
}
}
fclose(CarFile);
if(Carlist[playerid][Typ]!=-1 && Carlist[playerid][Status]==1)
{
Carlist[playerid][Carid]=CreateTunedCar(playerid);
SetVehicleParamsForAll(Carlist[playerid][Carid],0,1);
}
}
Und unter OnPlayerDisconnect, aber ich glaub das braucht man nicht, um den Fehler zu finden, oder?
Danke schonmal! ;D
Gruß,
Dennis