Random Spawns
#1

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
Reply
#2

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]);
}
Reply
#3

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?
Reply
#4

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.
Reply
#5

whats the 3 on randomspawns for?
Reply
#6

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

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

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?
Reply
#9

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
Reply
#10

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)