SA-MP Forums Archive
Vehicle is in use, put in other vehicle? - 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: Vehicle is in use, put in other vehicle? (/showthread.php?tid=146634)



Vehicle is in use, put in other vehicle? - 0ne - 08.05.2010

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?


Re: Vehicle is in use, put in other vehicle? - Jefff - 08.05.2010

Код:
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;
			}
		}
	}
}



Re: Vehicle is in use, put in other vehicle? - 0ne - 08.05.2010

thanks mate


Re: Vehicle is in use, put in other vehicle? - 0ne - 08.05.2010

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?


Re: Vehicle is in use, put in other vehicle? - 0ne - 09.05.2010

bump,

i did:

new chance = random(10);

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