SA-MP Forums Archive
Player Spawns - 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: Player Spawns (/showthread.php?tid=69014)



Player Spawns - V1ceC1ty - 15.03.2009

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


Re: Player Spawns - MenaceX^ - 15.03.2009

/Airport command?



Re: Player Spawns - mascii - 15.03.2009

Ill write for you next time im on comp


Re: Player Spawns - ICECOLDKILLAK8 - 15.03.2009

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]);



Re: Player Spawns - MenaceX^ - 15.03.2009

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


Re: Player Spawns - ICECOLDKILLAK8 - 15.03.2009

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



Re: Player Spawns - V1ceC1ty - 16.03.2009

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?


Re: Player Spawns - ICECOLDKILLAK8 - 16.03.2009

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


Re: Player Spawns - V1ceC1ty - 16.03.2009

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

Thanks for your help


Re: Player Spawns - mascii - 16.03.2009

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