12.08.2009, 17:29
Okay, so I'm editing the Public Enemy No. 1 script, but the /veh command crashes me
Here's the command;
Compiling goes fine, but if I try to spawn a car ingame, I crash.
Help would be highly appreciated!
Here's the command;
pawn Код:
if (strcmp(cmd, "/veh", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /veh [vehicleid]");
return 1;
}
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)
{
new weaponid = strval(tmp);
new Float:px, Float:py, Float:pz, Float:pa;
GetPlayerFacingAngle(playerid,pa);
GetPlayerPos(playerid, px, py, pz);
new coordsstring[256];
format(coordsstring, 256, "CreateVehicle(%d, %.1f,%.1f,%.1f,%.1f,-1,-1,-1);\n", weaponid, px, py, pz ,pa);
printf("AdmCmd:veh: %d was spawned", weaponid);
CreateVehicle(weaponid, px, py, pz, pa,-1,-1,10000);
new File:hFile;
hFile = fopen("coords.txt", io_append);
fwrite(hFile, coordsstring);
fclose(hFile);
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not authorized to use that command!");
}
return 1;
}
Help would be highly appreciated!