Dynamic Vehicle - 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)
+--- Thread: Dynamic Vehicle (
/showthread.php?tid=449248)
Dynamic Vehicle -
Tanush123 - 07.07.2013
Well i made a dynamic vehicle creator. But i want to get the ID of the vehicle when i enter the vehicle, when i enter the vehicle id i get the ID starting from 1 then it rapidly goes up
pawn Код:
onplayerstatechange
-
if(newstate == PLAYER_STATE_DRIVER)
{
if(tpark[playerid] == 1)
{
for(new i = 0;i<MAX_PARKS;i++)
{
vcpid[playerid] = i;
format(str,sizeof(str),"ID = %d",vcpid[playerid]);
SCM(playerid,lightyellow,str);
}
}
}
Re: Dynamic Vehicle -
Smokkr - 07.07.2013
Try this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new string[128];
format(string, sizeof(string), "Vehicle ID: %i",vehicleid);
SendClientMessage(playerid, -1, string);
return 1;
}
Re: Dynamic Vehicle -
Tanush123 - 07.07.2013
I need the vehicle id of /park, not the vehicle id on the gamemode

. ParkInfo[i][ID]
Re: Dynamic Vehicle -
Calabresi - 07.07.2013
It rapidly goes up because you don't have anything in your loop to limit the park ID. You can do that by checking if the vehicle's ID equals to parking place's vehicle ID.
Re: Dynamic Vehicle -
Tanush123 - 07.07.2013
Getting a warning
Код:
C:\Users\Owner\SA-MP\gamemodes\xG.pwn(5842) : warning 213: tag mismatch
5842: format(str,sizeof(str),"ID = %d",ParkInfo[i][ID]);
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
if(tpark[playerid] == 1)
{
for(new i = 0;i<MAX_PARKS;i++)
{
GetVehiclePos(GetPlayerVehicleID(playerid),X,Y,Z);
if(X == ParkInfo[i][pPosX] && Y == ParkInfo[i][pPosY] && Z == ParkInfo[i][pPosZ])
{
format(str,sizeof(str),"ID = %d",ParkInfo[i][ID]);
SCM(playerid,grey,str);
}
}
}
}