Checking If Someone Is In The Vehicle
#9

Quote:
Originally Posted by ATGOggy
Посмотреть сообщение
Add this somewhere in your script
PHP код:
new count=0;
stock IsAnyPlayerInVehicle(vehicleid)
{
    for(new 
i=0;i<MAX_PLAYERS;i++)
    {
        if(
IsPlayerConnected(i))
        {
             if(
IsPlayerInVehicle(ivehicleid)) count++;
        }
    }
    if(
count>0) return 1;
    return 
0;

and use it like:
PHP код:
if(IsAnyPlayerInVehicle(<your vehicle id>))
{
    
//Your code

IsPlayerConnected is not really needed as a player can't be in a vehicle if they are not connected, as LarzI said elsewhere,
Quote:

The code becomes slower with an unnecessary check like that.

Reply


Messages In This Thread
Checking If Someone Is In The Vehicle - by Ciarannn - 25.01.2015, 15:29
Re: Checking If Someone Is In The Vehicle - by Ironboy - 25.01.2015, 15:30
Re: Checking If Someone Is In The Vehicle - by RayC - 25.01.2015, 15:34
Re: Checking If Someone Is In The Vehicle - by Ciarannn - 25.01.2015, 16:15
Re: Checking If Someone Is In The Vehicle - by Luis- - 25.01.2015, 16:16
Re: Checking If Someone Is In The Vehicle - by Ciarannn - 25.01.2015, 16:37
Re: Checking If Someone Is In The Vehicle - by RayC - 25.01.2015, 16:41
Re: Checking If Someone Is In The Vehicle - by ATGOggy - 25.01.2015, 16:44
Re: Checking If Someone Is In The Vehicle - by RayC - 25.01.2015, 16:50
Re: Checking If Someone Is In The Vehicle - by ATGOggy - 25.01.2015, 16:56

Forum Jump:


Users browsing this thread: 1 Guest(s)