Guten Tag
Ich arbeite grade an einem autohaus script. Es funktioniert alles. Doch wenn man das Auto kauft und es nicht /parkt und man reloggt ist das Auto weg und Spawnt nicht wieder. Also bei dem Kauf speichert er den falsche wert oder so. in der datei steht dann posx: 000000 und wenn ich /park eingebe über nimmt er die geparkte coordinate dann steht da z.b posx: 12345678 und das auto spawnt dann nach einen restart. wieder da.
Wäre echt cool wenn ihr mir helfen könntet.
der /park befehl
if(strcmp(cmdtext, "/park", true) == 0)
{
new inveh = 0;
for(new i= 0;i < MAX_PLAYER_CARS;i++)
{
if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,FARBE_AUTOHAUS0,"Du musst in Deinem Auto sitzen!");
new vehicleid = GetPlayerVehicleID(playerid);
if(vehicleid == auto[playerid])
{
new Float:x,Float:y,Float:z,Float:rot;
GetVehiclePos(GetPlayerVehicleID(playerid),x,y,z);
GetVehicleZAngle(GetPlayerVehicleID(playerid),rot);
Autos[playerid][Park_x] = x;
Autos[playerid][Park_y] = y;
Autos[playerid][Park_z] = z;
Autos[playerid][Park_rot] = rot;
new Car[128];
format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",SpielerName(playerid), i);
dini_FloatSet(Car,"Car_X",Autos[playerid][Park_x]);
dini_FloatSet(Car,"Car_y",Autos[playerid][Park_y]);
dini_FloatSet(Car,"Car_Z",Autos[playerid][Park_z]);
dini_FloatSet(Car,"Car_ROT",Autos[playerid][Park_rot]);
SendClientMessage(playerid,0xFFFF00FF,"*Du hast dein Auto nun hier geparkt, du wirst es nun immer hier wieder finden.");
}
else
{
inveh = 1;
continue;
}
}
if(inveh == 0)
{
SendClientMessage(playerid,FARBE_AUTOHAUS0,"*Für dieses Auto besitzt du keine Schlüssel oder du bist zu weit weg!");
}
return 1;
}
Der Stock für den kauf
stock KaufAuto(playerid,autoid)
{
for(new i = 0; i < sizeof(BuyCars);i++)
{
if(GetPlayerVehicleID(playerid) == KaufAutos)
{
new Car[100];
format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",SpielerName(playerid),autoid);
dini_Create(Car);
dini_Set(Car,"Name",BuyCars[Name]);
dini_IntSet(Car,"modelid",BuyCars[modelid]);
dini_FloatSet(Car,"Car_X",BuyCars[kaufx]);
dini_FloatSet(Car,"Car_Y",BuyCars[kaufy]);
dini_FloatSet(Car,"Car_Z",BuyCars[kaufz]);
dini_FloatSet(Car,"Car_ROT",BuyCars[kaufrot]);
dini_IntSet(Car,"Farbe1",-1);
dini_IntSet(Car,"Farbe2",-1);
dini_IntSet(Car,"Paintjob",-1);
dini_IntSet(Car,"Preis",BuyCars[preis]);
auto[playerid][autoid] = CreateVehicle(BuyCars[modelid],BuyCars[kaufx],BuyCars[kaufy],BuyCars[kaufz],BuyCars[kaufrot],-1,-1,-1);
dini_IntSet(Car,"Spoiler",GetVehicleComponentInSlot(auto[playerid][autoid],0));
dini_IntSet(Car,"Hood",GetVehicleComponentInSlot(auto[playerid][autoid],1));
dini_IntSet(Car,"Roof",GetVehicleComponentInSlot(auto[playerid][autoid],2));
dini_IntSet(Car,"Sideskirt",GetVehicleComponentInSlot(auto[playerid][autoid],3));
dini_IntSet(Car,"Lamps",GetVehicleComponentInSlot(auto[playerid][autoid],4));
dini_IntSet(Car,"Nitro",GetVehicleComponentInSlot(auto[playerid][autoid],5));
dini_IntSet(Car,"Exhaust",GetVehicleComponentInSlot(auto[playerid][autoid],6));
dini_IntSet(Car,"Wheels",GetVehicleComponentInSlot(auto[playerid][autoid],7));
dini_IntSet(Car,"Stereo",GetVehicleComponentInSlot(auto[playerid][autoid],8));
dini_IntSet(Car,"Hydraulics",GetVehicleComponentInSlot(auto[playerid][autoid],9));
dini_IntSet(Car,"FrontBumper",GetVehicleComponentInSlot(auto[playerid][autoid],10));
dini_IntSet(Car,"RearBumper",GetVehicleComponentInSlot(auto[playerid][autoid],11));
dini_IntSet(Car,"VentRight",GetVehicleComponentInSlot(auto[playerid][autoid],12));
dini_IntSet(Car,"VentLeft",GetVehicleComponentInSlot(auto[playerid][autoid],13));
RemovePlayerFromVehicle(playerid);
TogglePlayerControllable(playerid,1);
GivePlayerMoney(playerid,-BuyCars[preis]);
Autos[playerid][autoid][preis] = dini_Int(Car,"Preis");
Autos[playerid][autoid][modelid] = dini_Int(Car,"modelid");
Autos[playerid][autoid][Farbe1] = dini_Int(Car,"Farbe1");
Autos[playerid][autoid][Farbe2] = dini_Int(Car,"Farbe2");
Autos[playerid][autoid][Paintjob] = dini_Int(Car,"Paintjob");
Autos[playerid][autoid][Park_x] = dini_Int(Car,"posx");
Autos[playerid][autoid][Park_y] = dini_Int(Car,"posy");
Autos[playerid][autoid][Park_z] = dini_Int(Car,"posz");
Autos[playerid][autoid][Park_rot] = dini_Int(Car,"posa");
Autos[playerid][autoid][Spoiler] = dini_Int(Car,"Spoiler");
Autos[playerid][autoid][Wheels] = dini_Int(Car,"Wheels");
Autos[playerid][autoid][Nitro] = dini_Int(Car,"Nitro");
Autos[playerid][autoid][Roof] = dini_Int(Car,"Roof");
Autos[playerid][autoid][Hood] = dini_Int(Car,"Hood");
Autos[playerid][autoid][Sideskirt] = dini_Int(Car,"Sideskirt");
Autos[playerid][autoid][Lamps] = dini_Int(Car,"Lamps");
Autos[playerid][autoid][Exhaust] = dini_Int(Car,"Exhaust");
Autos[playerid][autoid][Stereo] = dini_Int(Car,"Stereo");
Autos[playerid][autoid][Hydraulics] = dini_Int(Car,"Hydraulics");
Autos[playerid][autoid][VentRight] = dini_Int(Car,"VentRight");
Autos[playerid][autoid][VentLeft] = dini_Int(Car,"VentLeft");
Autos[playerid][autoid][FrontBumper] = dini_Int(Car,"FrontBumper");
Autos[playerid][autoid][RearBumper] = dini_Int(Car,"RearBumper");
carlock[auto[playerid][autoid]] = true;
}
}
}
On playerconnect
//autohaus
for(new i = 0;i < MAX_PLAYER_CARS;i++)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
new Car[128];
format(Car,sizeof(Car),"/Car/%s's Auto %d.txt",SpielerName(playerid),i);
if(!dini_Exists(Car)) continue;
{
Autos[playerid][Park_x]= dini_Float(Car,"Car_X");
Autos[playerid][Park_y]= dini_Float(Car,"Car_y");
Autos[playerid][Park_z]= dini_Float(Car,"Car_Z");
Autos[playerid][Park_rot]= dini_Float(Car,"Car_ROT");
Autos[playerid][Farbe1] = dini_Int(Car,"Farbe1");
Autos[playerid][Farbe2] = dini_Int(Car,"Farbe2");
Autos[playerid][Paintjob] = dini_Int(Car,"Paintjob");
Autos[playerid][modelid] = dini_Int(Car,"modelid");
Autos[playerid][Spoiler] = dini_Int(Car,"Spoiler");
Autos[playerid][Wheels] = dini_Int(Car,"Wheels");
Autos[playerid][Nitro] = dini_Int(Car,"Nitro");
Autos[playerid][Roof] = dini_Int(Car,"Roof");
Autos[playerid][Hood] = dini_Int(Car,"Hood");
Autos[playerid][Sideskirt] = dini_Int(Car,"Sideskirt");
Autos[playerid][Lamps] = dini_Int(Car,"Lamps");
Autos[playerid][Exhaust] = dini_Int(Car,"Exhaust");
Autos[playerid][Stereo] = dini_Int(Car,"Stereo");
Autos[playerid][Hydraulics] = dini_Int(Car,"Hydraulics");
Autos[playerid][VentRight] = dini_Int(Car,"VentRight");
Autos[playerid][VentLeft] = dini_Int(Car,"VentLeft");
Autos[playerid][FrontBumper] = dini_Int(Car,"FrontBumper");
Autos[playerid][RearBumper] = dini_Int(Car,"RearBumper");
Autos[playerid][modelid] = dini_Int(Car,"modelid");
Autos[playerid][preis] = dini_Int(Car,"Preis");
auto[playerid] = CreateVehicle(Autos[playerid][modelid],Autos[playerid][Park_x],Autos[playerid][Park_y],Autos[playerid][Park_z],Autos[playerid][Park_rot],-1,-1,-1);
if(Autos[playerid][Paintjob] >= 0)
{
ChangeVehiclePaintjob(auto[playerid],Autos[playerid][Paintjob]);
}
if(Autos[playerid][Farbe1] >= 0 || Autos[playerid][Farbe2] >= 0)
{
ChangeVehicleColor(auto[playerid],Autos[playerid][Farbe1],Autos[playerid][Farbe2]);
}
if(Autos[playerid][Spoiler] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Spoiler]); }
if(Autos[playerid][Hood] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Hood]); }
if(Autos[playerid][Roof] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Roof]); }
if(Autos[playerid][Sideskirt] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Sideskirt]); }
if(Autos[playerid][Lamps] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Lamps]); }
if(Autos[playerid][Nitro] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Nitro]); }
if(Autos[playerid][Exhaust] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Exhaust]); }
if(Autos[playerid][Wheels] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Wheels]); }
if(Autos[playerid][Stereo] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Stereo]); }
if(Autos[playerid][Hydraulics] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][Hydraulics]); }
if(Autos[playerid][FrontBumper] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][FrontBumper]); }
if(Autos[playerid][RearBumper] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][RearBumper]); }
if(Autos[playerid][VentRight] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][VentRight]); }
if(Autos[playerid][VentLeft] >= 1000) { AddVehicleComponent(auto[playerid],Autos[playerid][VentLeft]); }
GetVehicleParamsEx(auto[playerid],engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(auto[playerid],engine,lights,alarm,true,bonnet,boot,objective);
carlock[auto[playerid]] = true;
}
}[i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i]
und hier ist der Stock für den /Buycar Dialog
[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]enum AKinfo
{
modelid,
Name[54],
preis,
Float:kaufx,
Float:kaufy,
Float:kaufz,
Float:kaufrot,
Float:spawnx,
Float:spawny,
Float:spawnz,
Float:spawnrot
}[i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i]
und der ainfo stock
[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]enum Ainfo
{
Float:Park_x,
Float:Park_y,
Float:Park_z,
Float:Park_rot,
Farbe1,
Farbe2,
Paintjob,
Spoiler,
Hood,
Roof,
Sideskirt,
Lamps,
Nitro,
Exhaust,
Wheels,
Stereo,
Hydraulics,
FrontBumper,
RearBumper,
VentRight,
VentLeft,
modelid,
preis
}[i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i][i]
[/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i][/i]
Ich hoffe jemand hat eine IDee. Ich würde mich echt über positivte Antworten freuen. Falls euch noch Codes fehlen einfach schreiben.
MFG
TRONIIXLP