Dynamic Vehicle
#1

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);
            }
        }
    }
Reply
#2

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;
}
Reply
#3

I need the vehicle id of /park, not the vehicle id on the gamemode . ParkInfo[i][ID]
Reply
#4

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.
Reply
#5

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);
                }
            }
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)