Hello. I have a problem with the command /v because if fits eg /v nrg what I need but how spawn /v 400 is spawn my car with a different id.
Код:
dcmd_v(playerid,params[])
{
new idx, iString[256];
iString = strtok(params, idx);
if(!strlen(iString))
{
SendClientMessage(playerid, COLOR_WHITE, "*Wpisz: /v [id_pojazdu/nazwa_pojazdu]");
return 1;
}
idx = GetVehicleModelIDFromName(params);
if(idx == -1)
{
idx = strval(iString);
if(idx < 400 || idx > 611)
{
SendClientMessage(playerid, COLOR_RED, "BŁĄD: Błędne ID lub Nazwa pojazdu.");
return 1;
}
}
new string[128];
new Float:X, Float:Y, Float:Z, Float:Angles;
GetPlayerPos(playerid, X, Y, Z);
GetPlayerFacingAngle(playerid, Angles);
PlayerInfo[playerid][PlayerCar] = CreateVehicle(idx, X, Y + 1, Z + 1.0, 90.0, random(20), random(20), 7200);
PutPlayerInVehicle(playerid, PlayerInfo[playerid][PlayerCar], 0);
new vehid = GetPlayerVehicleID(playerid);
SetVehicleZAngle(vehid, Angles);
Nitro[vehid] = 0;
format(string, sizeof(string), "* Zespawnowałeś/aś pojazd o nazwie: %s [ID: %i].",NazwyPojazdow[idx - 400], idx);
SendClientMessage(playerid, COLOR_GREEN, string);
return 1;
}