How to check if an int is in an array
#2

You need to loop through those array and check if ID exists in them.
PHP код:
//the function to check if its cop car or not
stock IsCopCar(vid)
{
         new 
i;
         for(
0sizeof(lspdinf); i++)if(vid == lspdinf[i])return true;
         for(
0sizeof(lspdche); i++)if(vid == lspdche[i])return true;
         for(
0sizeof(lspdbul); i++)if(vid == lspdbul[i])return true;
         return 
false;
}
//function usage: 
public OnPlayerEnterVehicle(playeridvehicleidispassenger)
{
        if(
IsCopCar(vehicleid))
        { 
dont let him in unless cop...}

Reply


Messages In This Thread
How to check if an int is in an array - by adithegman - 18.01.2016, 12:43
Re: How to check if an int is in an array - by BroZeus - 18.01.2016, 14:31
Re: How to check if an int is in an array - by Jefff - 18.01.2016, 14:59
Re: How to check if an int is in an array - by Pottus - 18.01.2016, 15:49
Re: How to check if an int is in an array - by adithegman - 18.01.2016, 16:26
Re: How to check if an int is in an array - by adithegman - 18.01.2016, 16:38

Forum Jump:


Users browsing this thread: 3 Guest(s)