SA-MP Forums Archive
Problem with the vehicle id - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with the vehicle id (/showthread.php?tid=126694)



Problem with the vehicle id - MrLeNy - 09.02.2010

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.
Here's the command:
Код:
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;
}