17.03.2016, 17:11
Try this:
PHP код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new index, cmd[20];
cmd = strtok(cmdtext, index);
if (strcmp(cmd, "/spawnauto", true) == 0)
{
new Float:vx, Float:vy, Float:vz, vid;
tmp = strtok(cmdtext, index);
if (!strlen(tmp)) return SendClientMessage(playerid, 0xF69521AA, "Utilizza: /spawnauto [vehicleid/nome]");
if (IsNumeric(tmp) == 1)
{
vid = strval(tmp);
} else {
vid = GetVehicleIDFromName(tmp);
}
if ((vid < 400) || (vid > 611) || (vid == 590) || (vid == 569) || (vid == 570) || (vid == 537) || (vid == 538) || (vid == 449))
{
return SendClientMessage(playerid, 0xF69521AA, "Veicolo non riconosciuto.");
}
else
{
GetPlayerPos(playerid, vx, vy, vz);
CreateVehicle(vid, vx + random(9) - 4, vy + random(9) - 4, vz, 0, -1, -1, -1);
new car = GetPlayerVehicleID(playerid);
format(stringa,sizeof(stringa),"{0xF69521AA}T{0xF69521AA}D{0xFFFF00AA} %d",random(999));
SetVehicleNumberPlate(car, stringa);
SendClientMessage(playerid, 0xFFFF00AA, "Auto Spawnata con successo");
return 1;
}
}
return 0;
}