18.01.2012, 00:01
As my title says, I made an /apark for my gamemode, and it gives me no error, and it seems to work when i look at /dl. But when you check the files, or restart server, it goes back to the old position. Heres the command, thanks in advance for the help.
pawn Код:
CMD:apark(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 4)
{
if(PlayerInfo[playerid][pADuty] == 1)
{
new cCar1 = GetPlayerVehicleID(playerid);
new
Float:Pos[4],
cColors[2];
GetVehiclePos(cCar1, Pos[0], Pos[1], Pos[2]);
GetVehicleZAngle(cCar1, Pos[3]);
VehicleInfo[cCar1][vColor1] = cColors[0];
VehicleInfo[cCar1][vColor2] = cColors[1];
new modelid = GetVehicleModel(cCar1);
DestroyVehicle(cCar1);
new
cCar = CreateVehicle(modelid, Pos[0], Pos[1], Pos[2], Pos[3], cColors[0], cColors[1], 50000);
PutPlayerInVehicle(playerid, cCar, 0);
new string[120];
format(string, sizeof(string), "%s%s%s-%d%d%d%d", LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], LetterList[random(sizeof(LetterList))], random(10), random(10), random(10), random(10));
SetVehicleNumberPlate(cCar, string);
SetVehicleToRespawn(cCar);
PutPlayerInVehicle(playerid, cCar, 0);
new modelid1 = GetVehicleModel(cCar);
new
vFile[128];
format(vFile, sizeof(vFile), VEHICLE_PATH, cCar);
new INI:Out = INI_Open(vFile);
INI_SetTag(Out,"data");
INI_WriteInt(Out,"Model",modelid1);
INI_WriteFloat(Out,"X",Pos[0]);
INI_WriteFloat(Out,"Y",Pos[1]);
INI_WriteFloat(Out,"Z",Pos[2]);
INI_WriteFloat(Out,"A",Pos[3]);
INI_WriteInt(Out,"Color1",cColors[0]);
INI_WriteInt(Out,"Color2",cColors[1]);
INI_WriteString(Out,"Plate",string);
}
}
return 1;
}