SA-MP Forums Archive
IsVehicleOccupied i GIVE REP ++ - 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: IsVehicleOccupied i GIVE REP ++ (/showthread.php?tid=551056)



IsVehicleOccupied i GIVE REP ++ - buburuzu19 - 16.12.2014

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;



Re: IsVehicleOccupied i GIVE REP ++ - M4D - 16.12.2014

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)


Re: IsVehicleOccupied i GIVE REP ++ - Divergent - 16.12.2014

Код:
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