Access everything in example[MAX_VEHICLES];
#1

Hi, in my mod if you buy a car, it saves as PlayerCar[playerid]

Now, i'm wondering how you get everything in that value to do for example:
If player enters car, check if somebody owns it and if they do, remove them from the vehicle, unless of course, it's their car. But if it's an ordinary car (that nobody bought) nothing happens.
Reply
#2

Add into public OnPlayerStateChange:

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
{
    new pcar = GetPlayerVehicleID(playerid);
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(IsPlayerConnected(i) && i != playerid)
        {
            if(PlayerCar[i] == pcar)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid, -1, "Your message for removed player...");
                break;
            }
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)