Hay Sorry das ich schon wider ein Thema erstelle!
Undzwar hab ich ein bug!
Ich erstelle das Auto mit /efa und parke das Auto und dann mache ich restart und dann ist das Auto weg?
[18:45:24] '1' Fraktionsfahrzeuge wurden geladen & erstellt.
public LoadFactionCars(){
if(!fexist(FACTION_CAR_FILE)){
new File:tfFile=fopen(FACTION_CAR_FILE,io_write);
fclose(tfFile);
}
new File:fFile=fopen(FACTION_CAR_FILE,io_read),Content[1024],fc;
while(fread(fFile,Content) && fc<sizeof(FactionCars)){
sscanf(Content,"dffffdddddddddddddddddddddd",
FactionCars[fc][fVehid],
FactionCars[fc][fPos][0],
FactionCars[fc][fPos][1],
FactionCars[fc][fPos][2],
FactionCars[fc][fPos][3],
FactionCars[fc][fCol][0],
FactionCars[fc][fCol][1],
FactionCars[fc][fFaction][0],
FactionCars[fc][fFaction][1],
FactionCars[fc][fFaction][2],
FactionCars[fc][fFaction][3],
FactionCars[fc][fFaction][4],
FactionCars[fc][fTuning][0],
FactionCars[fc][fTuning][1],
FactionCars[fc][fTuning][2],
FactionCars[fc][fTuning][3],
FactionCars[fc][fTuning][4],
FactionCars[fc][fTuning][5],
FactionCars[fc][fTuning][6],
FactionCars[fc][fTuning][7],
FactionCars[fc][fTuning][8],
FactionCars[fc][fTuning][9],
FactionCars[fc][fTuning][10],
FactionCars[fc][fTuning][11],
FactionCars[fc][fTuning][12],
FactionCars[fc][fTuning][13],
FactionCars[fc][fPrice]);
if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611){
FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
#if defined FACTION_CARS_LOCKABLE
fLockCar(FactionCars[fc][fCarid]);
FactionCars[fc][fLock] = true;
#endif
#if defined FACTION_CARS_TUNEABLE
if(IsAllowedFactionToTune(FactionCars[fc][fFaction][0])){
if(FactionCars[fc][fTuning][0] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][0]); }
if(FactionCars[fc][fTuning][1] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][1]); }
if(FactionCars[fc][fTuning][2] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][2]); }
if(FactionCars[fc][fTuning][3] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][3]); }
if(FactionCars[fc][fTuning][4] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][4]); }
if(FactionCars[fc][fTuning][5] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][5]); }
if(FactionCars[fc][fTuning][6] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][6]); }
if(FactionCars[fc][fTuning][7] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][7]); }
if(FactionCars[fc][fTuning][8] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][8]); }
if(FactionCars[fc][fTuning][9] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][9]); }
if(FactionCars[fc][fTuning][10] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][10]); }
if(FactionCars[fc][fTuning][11] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][11]); }
if(FactionCars[fc][fTuning][12] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][12]); }
if(FactionCars[fc][fTuning][13] != 0) { AddVehicleComponent(FactionCars[fc][fCarid],FactionCars[fc][fTuning][13]); }
}
#endif
fc++;
}
}fclose(fFile);
return printf(" '%d' Fraktionsfahrzeuge wurden geladen & erstellt.",fc);
}
public SaveFactionCars(bool:destroy)
{
printf("SaveFactionCars aufgerufen.");
if(fexist(FACTION_CAR_FILE)) fremove(FACTION_CAR_FILE);
new File:fFile=fopen(FACTION_CAR_FILE,io_append),Content[1024];
for(new fc;fc<sizeof(FactionCars);fc++)
{
printf("fc: %d | fVehid: %d", fc, FactionCars[fc][fVehid]);
if(FactionCars[fc][fVehid] >= 400 && FactionCars[fc][fVehid] <= 611)
{
for(new i=0; i<13; i++) FactionCars[fc][fTuning][i] = GetVehicleComponentInSlot(FactionCars[fc][fCarid], i);
format(Content,sizeof(Content),"%d %.3f %.3f %.3f %.3f %03d %03d %02d %02d %02d %02d %02d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d\r\n",
FactionCars[fc][fVehid],
FactionCars[fc][fPos][0],
FactionCars[fc][fPos][1],
FactionCars[fc][fPos][2],
FactionCars[fc][fPos][3],
FactionCars[fc][fCol][0],
FactionCars[fc][fCol][1],
FactionCars[fc][fFaction][0],
FactionCars[fc][fFaction][1],
FactionCars[fc][fFaction][2],
FactionCars[fc][fFaction][3],
FactionCars[fc][fFaction][4],
FactionCars[fc][fTuning][0],
FactionCars[fc][fTuning][1],
FactionCars[fc][fTuning][2],
FactionCars[fc][fTuning][3],
FactionCars[fc][fTuning][4],
FactionCars[fc][fTuning][5],
FactionCars[fc][fTuning][6],
FactionCars[fc][fTuning][7],
FactionCars[fc][fTuning][8],
FactionCars[fc][fTuning][9],
FactionCars[fc][fTuning][10],
FactionCars[fc][fTuning][11],
FactionCars[fc][fTuning][12],
FactionCars[fc][fTuning][13],
FactionCars[fc][fPrice]);
printf("Content: %s", Content);
fwrite(fFile,Content);
if(destroy == true)
{
if(DestroyVehicle(FactionCars[fc][fCarid]))
FactionCars[fc][fCarid] = -255;
}
}
}
printf("Ende.");
fclose(fFile);
return true;
}
dcmd_efa(playerid,params[]){
if(GetPlayerAdmin(playerid) >= NEEDED_ADMINLEVEL){
new vehid,col1,col2,faction[5];
if(!sscanf(params,"dddd",vehid,col1,col2,faction[0])){
sscanf(params,"dddddddd",vehid,col1,col2,faction[0],faction[1],faction[2],faction[3],faction[4]);
if(vehid < 400 || vehid > 611) return SendClientMessage(playerid,FACTION_COL_GREY,"Vehicle-ID nur von 400 bis 611.");
if(col1 < 0 || col1 > 255) return SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Farbe(1)!");
if(col2 < 0 || col2 > 255) return SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Farbe(2)!");
if(faction[0] && faction[0] <= MAX_FACTIONS){
for(new f;f<5;f++){
if(faction[f] <= 0 || faction[f] > MAX_FACTIONS){
faction[f] = -255;
}
}
for(new fc;fc<sizeof(FactionCars);fc++){
if(FactionCars[fc][fVehid] < 400 || FactionCars[fc][fVehid] > 611){
FactionCars[fc][fVehid] = vehid;
new Float:fX,Float:fY,Float:fZ,Float:fA;
GetPlayerPos(playerid,fX,fY,fZ),GetPlayerFacingAngle(playerid,fA);
FactionCars[fc][fPos][0] = fX;
FactionCars[fc][fPos][1] = fY;
FactionCars[fc][fPos][2] = fZ;
FactionCars[fc][fPos][3] = fA;
FactionCars[fc][fCol][0] = col1;
FactionCars[fc][fCol][1] = col2;
for(new f;f<5;f++){
FactionCars[fc][fFaction][f] = faction[f];
}
FactionCars[fc][fPrice] = 0;
for(new mod;mod<14;mod++)
FactionCars[fc][fTuning][mod] = 0;
FactionCars[fc][fCarid] = CreateVehicle(FactionCars[fc][fVehid],FactionCars[fc][fPos][0],FactionCars[fc][fPos][1],FactionCars[fc][fPos][2],FactionCars[fc][fPos][3],FactionCars[fc][fCol][0],FactionCars[fc][fCol][1],-255);
#if defined FACTION_CARS_LOCKABLE
FactionCars[fc][fLock] = true;
#endif
SendClientMessage(playerid,FACTION_COL_YELLOW,"Du hast das Fraktionsfahrzeug erfolgreich erstellt.");
SendClientMessage(playerid,FACTION_COL_YELLOW,"Vergesse es nicht mit '/fpark' umzuparken.");
PutPlayerInVehicle(playerid,FactionCars[fc][fCarid],0);
return true;
}
}SendClientMessage(playerid,FACTION_COL_GREY,"Die Maximale Anzahl von Fraktionsfahrzeugen wurde bereits erreicht.");
}else SendClientMessage(playerid,FACTION_COL_GREY,"Falsche Fraktion!");
}else SendClientMessage(playerid,FACTION_COL_GREY,"Benutze: '/efa [Model] [Farbe(1)] [Farbe(2)] [Hauptfraktion]'.");
}else SendClientMessage(playerid,FACTION_COL_GREY,"Du bist nicht berechtigt diesen Befehl anzuwenden.");
return true;
}
//E:
Server Log