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



Random Spawns - JoeDaDude - 28.12.2009

Ok ive made it so you cant select a skin,
Like, OnPlayerConnect callback is spawns the player auto, with code ofc,
Anyway, How do i get it so everytime a player spawns they spawn at random locations,
with random skins? is tht possible, i think it is, cud u tell me how


Re: Random Spawns - MadeMan - 28.12.2009

pawn Код:
new Float:RandomSpawns[4][3] = {
{1253.6213,368.9244,19.5614},
{1263.1244,369.7004,19.5547},
{1246.1509,368.8576,19.5547},
{1256.1157,364.1463,19.5614}
};

new RandomSkins[4] = {
125,126,127,128
};
pawn Код:
public OnPlayerSpawn(playerid)
{
    new rand = random(sizeof(RandomSpawns));
    SetPlayerPos(playerid, RandomSpawns[rand][0], RandomSpawns[rand][1], RandomSpawns[rand][2]);
    rand = random(sizeof(RandomSkins));
    SetPlayerSkin(playerid, RandomSkins[rand]);
}



Re: Random Spawns - JoeDaDude - 28.12.2009

And waht would i do if i wanted to add more skins and spawns?
Just keep it same just add 1 more skin id and coord?


Re: Random Spawns - MadeMan - 28.12.2009

Quote:
Originally Posted by JoeDaDude
And waht would i do if i wanted to add more skins and spawns?
Just keep it same just add 1 more skin id and coord?
Yes, but you also have to make that array bigger. For example they are both 4 now, if you want add 1, change it to 5.


Re: Random Spawns - JoeDaDude - 28.12.2009

whats the 3 on randomspawns for?


Re: Random Spawns - MadeMan - 28.12.2009

Quote:
Originally Posted by JoeDaDude
whats the 3 on randomspawns for?
There are 3 coords: X, Y and Z.


Re: Random Spawns - JoeDaDude - 28.12.2009

Im good at some bits of scripting but not all so,
Where do i put the float things


Re: Random Spawns - MadeMan - 28.12.2009

Quote:
Originally Posted by JoeDaDude
Im good at some bits of scripting but not all so,
Where do i put the float things
Float things? What do you want to do?


Re: Random Spawns - JoeDaDude - 28.12.2009

pawn Код:
new Float:RandomSpawns[4][3] = {
{1253.6213,368.9244,19.5614},
{1263.1244,369.7004,19.5547},
{1246.1509,368.8576,19.5547},
{1256.1157,364.1463,19.5614}
};

new RandomSkins[4] = {
125,126,127,128
};
Where do i put them


Re: Random Spawns - MadeMan - 28.12.2009

Quote:
Originally Posted by JoeDaDude
pawn Код:
new Float:RandomSpawns[4][3] = {
{1253.6213,368.9244,19.5614},
{1263.1244,369.7004,19.5547},
{1246.1509,368.8576,19.5547},
{1256.1157,364.1463,19.5614}
};

new RandomSkins[4] = {
125,126,127,128
};
Where do i put them
Top of the script.