Hey Leute,
ich hab ein Efa Befehl gescriptet. Soweit funktioniert alles. Die Datei wird gespeichert auch mit den richtigen Daten. Doch 2 Probleme habe ich.
1. Die Fahrzeuge werden nicht geladen.
2. Die FahrzeugID (vehicleid bzw. eID) ist immer 452.
//EFA Systemocmd:efa(playerid,params[]){new model,frak,color1,color2,Float:x,Float:y,Float:z,Float:a,text[20];if(IsPlayerConnected(playerid))if(gPlayerLogged[playerid] == 1)if(PlayerInfo[playerid][pAdmin] < 6)return SendClientMessage(playerid,COLOR_RED,"Fehler: Du bist dazu nicht befugt.");if(IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,COLOR_GRAD1,"Du bist in einem Fahrzeug.");if(sscanf(params,"dddds",model,frak,color1,color2,text))return SendClientMessage(playerid,COLOR_GRAD1,"Benutze: /efa [FahrzeugID] [Fraktion] [Farbe1] [Farbe2] [Kennzeichen]");if(model < 400 || model > 611)return SendClientMessage(playerid,COLOR_GRAD1,"Die FahrzeugID muss zwischen 400 und 611 liegen.");if(frak != 1 && frak != 4 && frak != 9 && frak != 13 && frak != 14 && frak != 24 && frak != 22 && frak != 12 && frak != 16)return SendClientMessage(playerid,COLOR_GRAD1,"Diese Fraktion existiert nicht.");if(color1 < 0 || color1 > 255)return SendClientMessage(playerid,COLOR_GRAD1,"Die FarbID muss zwischen 0 und 255 liegen.");if(color2 < 0 || color2 > 255)return SendClientMessage(playerid,COLOR_GRAD1,"Die FarbID muss zwischen 0 und 255 liegen.");if(strlen(text) < 4 || strlen(text) > 15)return SendClientMessage(playerid,COLOR_GRAD1,"Das Kennzeichen muss zwischen 4 und 15 Buchstaben haben.");GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid,a);new carid = CreateVehicle(model,x,y,z,a,color1,color2,-1);EfaFahrzeug[carid][eposx] = x; EfaFahrzeug[carid][eposy] = y; EfaFahrzeug[carid][eposz] = z; EfaFahrzeug[carid][eposa] = a;EfaFahrzeug[carid][eColor1] = color1; EfaFahrzeug[carid][eColor2] = color2; EfaFahrzeug[carid][eModel] = model;EfaFahrzeug[carid][eFrak] = frak; EfaFahrzeug[carid][eID] = carid; EfaFahrzeug[carid][eKennzeichen] = text;SetVehicleNumberPlate(carid,text);PutPlayerInVehicle(playerid, carid, 0);SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du hast erfolgreich ein Fahrzeug erstellt. Lass es nun mit /fpark parken.");CreateEFACAR(carid,model,x,y,z,a,color1,color2,text,frak);return 1;}ocmd:fpark(playerid,params[]){#pragma unused paramsnew Float:x,Float:y,Float:z,Float:a,vehicleid = GetPlayerVehicleID(playerid);if(IsPlayerConnected(playerid))if(gPlayerLogged[playerid] == 1)if(PlayerInfo[playerid][pLeader] == 0)return SendClientMessage(playerid,COLOR_GRAD1,"Du bist kein Leader einer Fraktion.");if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht in einem Fahrzeug.");if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)return SendClientMessage(playerid,COLOR_GRAD1,"Du bist nicht der Fahrer dieses Fahrzeuges.");if(EfaFahrzeug[vehicleid][eFrak] == PlayerInfo[playerid][pLeader]){GetPlayerPos(playerid,x,y,z); GetPlayerFacingAngle(playerid,a);SendClientMessage(playerid,COLOR_LIGHTBLUE,"Das Fahrzeug wurde erfolgreich an dieser Stelle geparkt.");EfaFahrzeug[vehicleid][eposx] = x; EfaFahrzeug[vehicleid][eposy] = y; EfaFahrzeug[vehicleid][eposz] = z; EfaFahrzeug[vehicleid][eposa] = a;UpdateEFACAR(vehicleid);}else SendClientMessage(playerid,COLOR_GRAD1,"Dieses Fahrzeug gehört nicht deiner Fraktion an.");return 1;}
//EFA SystemFunction CreateEFACAR(id,model,Float:x,Float:y,Float:z,Float:a,color1,color2,kennzeichen[20],frak){new str[128];format(str, sizeof str, "/FrakAutos/%s%d.dtcar",kennzeichen,id);new File: hFile = fopen(str, io_write);if (hFile){new var[32];format(var, 32, "eCarId=%d\n",id);fwrite(hFile, var);format(var, 32, "eCarModel=%d\n",model);fwrite(hFile, var);format(var, 32, "eCarPos_x=%.3f\n",x);fwrite(hFile, var);format(var, 32, "eCarPos_y=%.3f\n",y);fwrite(hFile, var);format(var, 32, "eCarPos_z=%.3f\n",z);fwrite(hFile, var);format(var, 32, "eCarRotate=%.3f\n",a);fwrite(hFile, var);format(var, 32, "eCarNitro=0\n");fwrite(hFile, var);format(var, 32, "eCarHyd=0\n");fwrite(hFile, var);format(var, 32, "eCarWheel=0\n");fwrite(hFile, var);format(var, 32, "eCarAusp=0\n");fwrite(hFile, var);format(var, 32, "eCarSideL=0\n");fwrite(hFile, var);format(var, 32, "eCarSideR=0\n");fwrite(hFile, var);format(var, 32, "eCarFB=0\n");fwrite(hFile, var);format(var, 32, "eCarRB=0\n");fwrite(hFile, var);format(var, 32, "eCarSpoiler=0\n");fwrite(hFile, var);format(var, 32, "eCarRoof=0\n");fwrite(hFile, var);format(var, 32, "eCarHood=0\n");fwrite(hFile, var);format(var, 32, "eCarVents=0\n");fwrite(hFile, var);format(var, 32, "eCarLamps=0\n");fwrite(hFile, var);format(var, 32, "eCarC1=%d\n",color1);fwrite(hFile, var);format(var, 32, "eCarC2=%d\n",color2);fwrite(hFile, var);format(var, 32, "eCarArrest=0\n");fwrite(hFile, var);format(var, 32, "ePlate=%s\n",kennzeichen);fwrite(hFile, var);format(var, 32, "eFrak=%d\n",frak);fwrite(hFile, var);fclose(hFile);}}Function UpdateEFACAR(vehicleid){new string3[128];format(string3, sizeof(string3), "/FrakAutos/%s%d.dtcar",EfaFahrzeug[vehicleid][eKennzeichen],vehicleid);new File: hFile = fopen(string3, io_write);if (hFile){new var[32];format(var, 32, "eCarId=%d\n",EfaFahrzeug[vehicleid][eID]);fwrite(hFile, var);format(var, 32, "eCarModel=%d\n",EfaFahrzeug[vehicleid][eModel]);fwrite(hFile, var);format(var, 32, "eCarPos_x=%.3f\n",EfaFahrzeug[vehicleid][eposx]);fwrite(hFile, var);format(var, 32, "eCarPos_y=%.3f\n",EfaFahrzeug[vehicleid][eposy]);fwrite(hFile, var);format(var, 32, "eCarPos_z=%.3f\n",EfaFahrzeug[vehicleid][eposz]);fwrite(hFile, var);format(var, 32, "eCarRotate=%.3f\n",EfaFahrzeug[vehicleid][eposa]);fwrite(hFile, var);format(var, 32, "eCarNitro=0\n");fwrite(hFile, var);format(var, 32, "eCarHyd=0\n");fwrite(hFile, var);format(var, 32, "eCarWheel=0\n");fwrite(hFile, var);format(var, 32, "eCarAusp=0\n");fwrite(hFile, var);format(var, 32, "eCarSideL=0\n");fwrite(hFile, var);format(var, 32, "eCarSideR=0\n");fwrite(hFile, var);format(var, 32, "eCarFB=0\n");fwrite(hFile, var);format(var, 32, "eCarRB=0\n");fwrite(hFile, var);format(var, 32, "eCarSpoiler=0\n");fwrite(hFile, var);format(var, 32, "eCarRoof=0\n");fwrite(hFile, var);format(var, 32, "eCarHood=0\n");fwrite(hFile, var);format(var, 32, "eCarVents=0\n");fwrite(hFile, var);format(var, 32, "eCarLamps=0\n");fwrite(hFile, var);format(var, 32, "eCarC1=%d\n",EfaFahrzeug[vehicleid][eColor1]);fwrite(hFile, var);format(var, 32, "eCarC2=%d\n",EfaFahrzeug[vehicleid][eColor2]);fwrite(hFile, var);format(var, 32, "eCarArrest=0\n");fwrite(hFile, var);format(var, 32, "ePlate=%s\n",EfaFahrzeug[vehicleid][eKennzeichen]);fwrite(hFile, var);fclose(hFile);}}Function SaveEFACAR(vehicleid){new string3[128];format(string3, sizeof(string3), "/FrakAutos/%s%d.dtcar", EfaFahrzeug[vehicleid][eKennzeichen],EfaFahrzeug[vehicleid][eID]);new File: hFile = fopen(string3, io_write);if (hFile){new var[32];format(var, 32, "eCarId=%d\n",EfaFahrzeug[vehicleid][eID]);fwrite(hFile, var);format(var, 32, "eCarModel=%d\n",EfaFahrzeug[vehicleid][eModel]);fwrite(hFile, var);format(var, 32, "eCarPos_x=%.3f\n",EfaFahrzeug[vehicleid][eposx]);fwrite(hFile, var);format(var, 32, "eCarPos_y=%.3f\n",EfaFahrzeug[vehicleid][eposy]);fwrite(hFile, var);format(var, 32, "eCarPos_z=%.3f\n",EfaFahrzeug[vehicleid][eposz]);fwrite(hFile, var);format(var, 32, "eCarRotate=%.3f\n",EfaFahrzeug[vehicleid][eposa]);fwrite(hFile, var);format(var, 32, "eCarNitro=0\n");fwrite(hFile, var);format(var, 32, "eCarHyd=0\n");fwrite(hFile, var);format(var, 32, "eCarWheel=0\n");fwrite(hFile, var);format(var, 32, "eCarAusp=0\n");fwrite(hFile, var);format(var, 32, "eCarSideL=0\n");fwrite(hFile, var);format(var, 32, "eCarSideR=0\n");fwrite(hFile, var);format(var, 32, "eCarFB=0\n");fwrite(hFile, var);format(var, 32, "eCarRB=0\n");fwrite(hFile, var);format(var, 32, "eCarSpoiler=0\n");fwrite(hFile, var);format(var, 32, "eCarRoof=0\n");fwrite(hFile, var);format(var, 32, "eCarHood=0\n");fwrite(hFile, var);format(var, 32, "eCarVents=0\n");fwrite(hFile, var);format(var, 32, "eCarLamps=0\n");fwrite(hFile, var);format(var, 32, "eCarC1=%d\n",EfaFahrzeug[vehicleid][eColor1]);fwrite(hFile, var);format(var, 32, "eCarC2=%d\n",EfaFahrzeug[vehicleid][eColor2]);fwrite(hFile, var);format(var, 32, "eCarArrest=0\n");fwrite(hFile, var);format(var, 32, "ePlate=%s\n",EfaFahrzeug[vehicleid][eKennzeichen]);fwrite(hFile, var);fclose(hFile);}}Function LoadEFACAR(vehicleid){new string2[128];format(string2, sizeof(string2), "/FrakAutos/%s%d.dtcar",EfaFahrzeug[vehicleid][eKennzeichen],EfaFahrzeug[vehicleid][eID]);new File: UserFile = fopen(string2, io_read);if (UserFile){new key[ 256 ] , val[ 256 ];new Data[ 256 ];while ( fread( UserFile , Data , sizeof( Data ) ) ){key = ini_GetKey( Data );if( strcmp( key , "eCarId" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eID] = strval( val ); }if( strcmp( key , "eCarModel" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eModel] = strval( val ); }if( strcmp( key , "eCarPos_x" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eposx] = floatstr( val ); }if( strcmp( key , "eCarPos_y" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eposy] = floatstr( val ); }if( strcmp( key , "eCarPos_z" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eposz] = floatstr( val ); }if( strcmp( key , "eCarRotate" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eposa] = floatstr( val ); }if( strcmp( key , "eCarNitro" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarHyd" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarWheel" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarAusp" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarSideL" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarSideR" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarFB" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarRB" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarSpoiler" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarRoof" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarHood" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarVents" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarLamps" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "eCarC1" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eColor1] = strval( val ); }if( strcmp( key , "eCarC2" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eColor2] = strval( val ); }if( strcmp( key , "eCarArrest" , true ) == 0 ) { val = ini_GetValue( Data ); }if( strcmp( key , "ePlate" , true ) == 0 ) { val = ini_GetValue( Data ); EfaFahrzeug[vehicleid][eKennzeichen] = strval( val ); }}fclose(UserFile);}}
Function OnGameModeInit(){SetTimer("WetterSet",3600000+random(1200000),false);//################################[ ATM ]###################################LoadATM();for(new i = 0; i < MAX_VEHICLES; i++){LoadEFACAR(i);}
Ich hoffe jemand kann helfen.
MfG
Skynox
//push