PDA

View Full Version : Admin Park - No errors - Just doesn't work


Abreezy
18/01/2012, 01:01 AM
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.

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;
}

xSiiLenTx
18/01/2012, 01:11 AM
Where's it located, in los santos? if so, where?

Abreezy
18/01/2012, 01:16 AM
Where's it located, in los santos? if so, where?

What does this have to do with anything at all ?

Snowman12
18/01/2012, 01:42 AM
do you load its position on GM int?

Abreezy
18/01/2012, 02:26 AM
Yeah I do.


LoadVehicles();

stock LoadVehicles()
{
new counter = 0;
for(new i = 0;i<SCRIPT_CARS;i++)
{
new file[64];format(file,sizeof file,VEHICLE_PATH,i);
if(fexist(file))
{
new INI:handler = INI_Open(file);
INI_ParseFile(file,"LoadVehicle",.bExtra = true, .extra = i);
VehicleInfo[i][vID] = CreateVehicle(VehicleInfo[i][vModel],VehicleInfo[i][vPosX],VehicleInfo[i][vPosY],VehicleInfo[i][vPosZ],VehicleInfo[i][vPosA],VehicleInfo[i][vColor1],VehicleInfo[i][vColor2], 5000);
SetVehicleNumberPlate(VehicleInfo[i][vID], VehicleInfo[i][vPlate]);
SetVehicleToRespawn(VehicleInfo[i][vID]);
INI_Close(handler);
counter++;

}
}
printf("%i vehicle(s) loaded.",counter);
}