25.03.2009, 10:41
What's wrong with this command, when I spawn a car, I crash :S.
pawn Код:
dcmd_car(playerid, cmdtext[])
{
new string[128];
new Float:X, Float:Y, Float:Z, Float:Angle;
new tmp[256], idx;
tmp = strtok(cmdtext, idx);
new car;
car = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ORANGE, "USAGE: /car [VEHICLEID]");
return 1;
}
else
{
if(car < 400 || car > 611)
{
SendClientMessage(playerid, COLOR_WARN, "Wrong VEHICLEID.");
}
}
GetPlayerPos(playerid, Float:X, Float:Y, Float:Z);
GetPlayerFacingAngle(playerid, Float:Angle);
CreateVehicle(car, Float:X, Float:Y, Float:Z + 2.0, Float:Angle + 90.0, -1, -1, 5000);
format(string, sizeof(string), "You have created a vehicle:(VEHICLEID: %d)", cmdtext);
SendClientMessage(playerid, COLOR_GREEN, string);
SendClientMessage(playerid, COLOR_WHITE, "Delete your vehicle after using.");
return 1;
}