IsVehicleOccupied i GIVE REP ++
#1

How to move IsVehicleOccupied to playerid , i tried something like this and nothing works:
pawn Код:
stock IsVehicleOccupied2(vehicleid,playerid)
{
    if(IsPlayerInVehicle(playerid, vehicleid)) return 1;
    return 0;
}
And i added a test:
pawn Код:
At on playerentervehicle
    if(IsVehicleOccupied2(251,playerid))
    {
        SCM(playerid, -1, "Test");
    }
return 1;
Reply
#2

You want check the vehicle that someone wants enter is occupied or no ?
If yes you have to change your stock code
You have to make a loop in your stock (you don't need playerid parameter)
Reply
#3

Код:
stock IsVehicleOccupied2(vehicleid)
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerInVehicle(i, vehicleid)) return 1;
    }
   return 0;
}
}
If you want to check if a specific player is in the vehicle then you don't even need to make a stock, just use IsPlayerInVehicle

[code]
vehicleid = CreateVehicle(etc.
if(IsPlayerInVehicle(playerid, vehicleid))
{
SendClientMessage(etc
}
[/code
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)