Player Spawns
#1

I want to add random player spawns to a command but i dont know how

if the player types e.g. /airport it will randomly spawn them in these locations:
-2764.6,1317.5,7.2
-2942.7,1361.2,10.7
-2896.7,1379.1,10.5
-2962.1,1466.0,10.8

and can you get random skins: 114, 108


Much Appreciated if you can help
Reply
#2

/Airport command?
Reply
#3

Ill write for you next time im on comp
Reply
#4

pawn Код:
// Top Of Script
new ASpawns[4][3]
{
{-2764.6,1317.5,7.2},
{-2942.7,1361.2,10.7},
{-2896.7,1379.1,10.5},
{-2962.1,1466.0,10.8}
}
// Command
new rand = random(4);
SetPlayerPos(playerid, ASpawns[rand][0],ASpawns[rand][1],ASpawns[rand][2]);
And for skins
pawn Код:
// Top of script
new RSkins[4][1]// Change the 4 to amount of skins
{
{skinid},
{skinid},
{skinid},
{skinid}
}
// Command
new rand = random(4);// Change 4 to amount of skins
SetPlayerSkin(playerid, RSkins[rand][0]);
Reply
#5

Why's that? Maybe he just wants a simple teleport to the airport..
Reply
#6

Quote:
Originally Posted by MenaceX^
Why's that? Maybe he just wants a simple teleport to the airport..
Have you read his post?
Quote:
Originally Posted by V1ceC1ty
I want to add random player spawns to a command but i dont know how
.....
and can you get random skins: 114, 108
Reply
#7

Quote:
Originally Posted by JeNkStAX
pawn Код:
// Top Of Script
new ASpawns[4][3]
{
{-2764.6,1317.5,7.2},
{-2942.7,1361.2,10.7},
{-2896.7,1379.1,10.5},
{-2962.1,1466.0,10.8}
}
// Command
new rand = random(4);
SetPlayerPos(playerid, ASpawns[rand][0],ASpawns[rand][1],ASpawns[rand][2]);
And for skins
pawn Код:
// Top of script
new RSkins[4][1]// Change the 4 to amount of skins
{
{skinid},
{skinid},
{skinid},
{skinid}
}
// Command
new rand = random(4);// Change 4 to amount of skins
SetPlayerSkin(playerid, RSkins[rand][0]);
so i add them to the top of my script and when a player types what? it teles them to my co-ords?
Reply
#8

Quote:
Originally Posted by V1ceC1ty
Quote:
Originally Posted by JeNkStAX
pawn Код:
// Top Of Script
new ASpawns[4][3]
{
{-2764.6,1317.5,7.2},
{-2942.7,1361.2,10.7},
{-2896.7,1379.1,10.5},
{-2962.1,1466.0,10.8}
}
// Command
new rand = random(4);
SetPlayerPos(playerid, ASpawns[rand][0],ASpawns[rand][1],ASpawns[rand][2]);
And for skins
pawn Код:
// Top of script
new RSkins[4][1]// Change the 4 to amount of skins
{
{skinid},
{skinid},
{skinid},
{skinid}
}
// Command
new rand = random(4);// Change 4 to amount of skins
SetPlayerSkin(playerid, RSkins[rand][0]);
so i add them to the top of my script and when a player types what? it teles them to my co-ords?
Read the comments, And yes, It will teleport them to a random co ord out of them 4
Reply
#9

what do they type if they want to go their and how can i change it?

Thanks for your help
Reply
#10

here you go, clean and simple

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/airport", cmdtext, true, 10) == 0)
	{
 		new randtele = random(4);
		switch(randtele)
		{
			case 0: SetPlayerPos(playerid, -2764.6,1317.5,7.2);
			case 1: SetPlayerPos(playerid, -2942.7,1361.2,10.7);
			case 2: SetPlayerPos(playerid, -2896.7,1379.1,10.5);
			case 3: SetPlayerPos(playerid, -2962.1,1466.0,10.8);
		}
		return 1;
	}
	return 0;
}
don't know about the skins though

you could try this for random skins and random teleports

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/airport", cmdtext, true, 10) == 0)
	{
 		new randtele = random(8);
		switch(randtele)
		{
			case 0: SetPlayerPos(playerid, -2764.6,1317.5,7.2), SetPlayerSkin(playerid,114);
			case 1: SetPlayerPos(playerid, -2942.7,1361.2,10.7), SetPlayerSkin(playerid,114);
			case 2: SetPlayerPos(playerid, -2896.7,1379.1,10.5), SetPlayerSkin(playerid,114);
			case 3: SetPlayerPos(playerid, -2962.1,1466.0,10.8), SetPlayerSkin(playerid,114);

			case 4: SetPlayerPos(playerid, -2764.6,1317.5,7.2), SetPlayerSkin(playerid,108);
			case 5: SetPlayerPos(playerid, -2942.7,1361.2,10.7), SetPlayerSkin(playerid,108);
			case 6: SetPlayerPos(playerid, -2896.7,1379.1,10.5), SetPlayerSkin(playerid,108);
			case 7: SetPlayerPos(playerid, -2962.1,1466.0,10.8), SetPlayerSkin(playerid,108);
			
		}
		return 1;
	}
	return 0;
}
hope this helps
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)