variable question
#3

Wow. That's a lot of code!

pawn Код:
new pd[?];

// To check if they are in any of the pd[] vehicles:

new vid = GetPlayerVehicleID(playerid);
new found;
for(new i=0; i<sizeof(pd); i++) // Loop through all pd[x] vehicle IDs
{
    if(vid == pd[i]) // If they are in that vehicle
    {
        found = 1;
        break; // End loop
    }
}
if(found)
{
    // They are in one of the pd[x] vehicles
}
else
{
    // They are not
}
A word of advice - name your vehicles better. When you come back in the future you'll be like 'what the fuck is pd[]' and end up looking all through your code trying to work it out. For example, gPoliceVehicleID[] instead.
Reply


Messages In This Thread
variable question - by Stuneris - 27.05.2012, 08:01
Re: variable question - by Gangs_Rocks - 27.05.2012, 08:13
Re: variable question - by MP2 - 27.05.2012, 08:17
Re: variable question - by Stuneris - 27.05.2012, 08:36
Re: variable question - by MP2 - 27.05.2012, 08:40
Re: variable question - by Stuneris - 27.05.2012, 08:43
Re: variable question - by MP2 - 27.05.2012, 08:47
Re: variable question - by Stuneris - 27.05.2012, 08:49
Re: variable question - by MP2 - 27.05.2012, 08:51

Forum Jump:


Users browsing this thread: 1 Guest(s)