SA-MP Forums Archive
function help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: function help (/showthread.php?tid=154526)



function help - Dj_maryo1993 - 14.06.2010

Can i check in any whay if an car has any player in it ? like an function or something , IsAnyPlayerInVehicle .


Re: function help - MadeMan - 14.06.2010

pawn Код:
stock IsAnyPlayerInVehicle(vehicleid)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInVehicle(i, vehicleid))
            {
                return 1;
            }
        }
    }
    return 0;
}



Re: function help - Dj_maryo1993 - 14.06.2010

ok thnx , but that will take huge amount of time , looping trough 150 + vehicles for 150 players will be an disaster , and if i do this every 10minutes ..


Re: function help - MadeMan - 14.06.2010

It may take you huge amount of time, but computer does it fast