Vehicle is in use, put in other vehicle?
#1

Could anyone explain me how to do a thing like:

I got

hunter1 = addstaticveh...
hunter2 = addstaticveh...

when a player spawns , how to put him in the HUNTER1 or HUNTER2, ex: if hunter1 is already occupied by other guy it would put him in not occupied hunter2? i got about 20helicopters so, i get the point only doing like:

new inhunter1;
new inhunter2;

onplayerenterveh, inhunter1 = 1 and so on, then

onleaveveh inhunter1 = 0;

but that would just do more lines to my script, i think there is another way to do it easier? is it?
Reply
#2

Код:
new Hunter[20];
Hunter[0] = AddStatic...
...
...
Hunter[19] = AddStatic
Spawn:
Код:
for(new i,g=GetMaxPlayers(); i < g; i++) if(IsPlayerConnected(i) && !IsPlayerNPC(i))
{
	if(i != playerid)
	{
		for(new d; d <20; d++)
		{
			if(!IsPlayerInVehicle(i,Hunter[d]))
			{
				PutPlayerInVehicle(playerid,Hunter[d],0);
				break;
			}
		}
	}
}
Reply
#3

thanks mate
Reply
#4

Very sorry for duoble post,

pawn Код:
new chance;
                              switch(chance)
                                {
                                    case 0: return PutPlayerInVehicle(playerid,hunter[d],0);
                                    case 1: return PutPlayerInVehicle(playerid,hydra[d],0);
would this work, i want to put him either in hunter or other way in hydra?
Reply
#5

bump,

i did:

new chance = random(10);

but the thing is that it doesn't put me in the vehicle..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)