Random spawns
#1

Done ty all
Reply
#2

How did you declare the gRandomSpawns array?
Reply
#3

Hello, for random spawns you should do something like this:

Code:
new RandomSpawn = random(3);
switch(RandomSpawn)
{
    case 0: SetPlayerPos(1);
    case 1: SetPlayerPos(2);
    case 2: SetPlayerPos(3);
}
Reply
#4

REMOVED
Reply
#5

Comon help me, i tried this more than a day, and i will finish my server but it cant if i cant finish my spawn!!
Reply
#6

what's line 361 and 360 ?
Reply
#7

This is line 360:
PHP Code:
new rand random(sizeof(gRandomSpawns)); 
And this is line 361:
PHP Code:
SetPlayerPos(playeridgRandomSpawns[rand][0], gRandomSpawns[rand][1], gRandomSpawns[rand][2]); 
Reply
#8

Show your gRandomSpawns
Reply
#9

pawn Code:
new Float:gRandomSpawns[][] = //Grove
{
    {2509.3162,-1654.4011,13.6194, /*Angle?*/},
    {2511.2471,-1688.7179,13.5511, /*Angle?*/},
    {2471.9990,-1686.6086,13.5078, /*Angle?*/},
    {2509.3162,-1654.4011,13.6194, /*Angle?*/}
};
Reply
#10

pawn Code:
new Float:gRandomSpawns[4][3] =
{
    {2509.3162,-1654.4011,13.6194},
    {2511.2471,-1688.7179,13.5511},
    {2471.9990,-1686.6086,13.5078},
    {2509.3162,-1654.4011,13.6194}
};

public OnPlayerSpawn(playerid)
{
    switch(GetPlayerSkin(playerid))
    {
        case 105,106,107,269,270,271:
        {
              new rand = random(sizeof(gRandomSpawns));
              SetPlayerPos(playerid, gRandomSpawns[rand][0], gRandomSpawns[rand][1], gRandomSpawns[rand][2]);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)