Random spawns dont work?
#1

Basically, I have added the random spawns following this tutorial :

https://sampforum.blast.hk/showthread.php?tid=162488

I have done it , so its like this

pawn Код:
new Float:RandomSpawns[][] =
{
    {-1960.8276,-854.2136,32.2188,182.3284}, // Randomspawn 1
    {-2043.7568,-39.8849,35.4227,357.6480}, // Randomspawn 2
    {-2269.7905,220.2377,35.3153,174.5811}, // Randomspawn 3
    {-2649.6274,16.6343,6.1328,4.0869}, // Randomspawn 4
    {-2548.9504,814.3687,49.9844,189.6447}, // Randomspawn 5
    {-2655.3545,1348.3672,7.0954,285.7137}, // Randomspawn 6
    {-1843.6552,1087.6333,46.0781,355.9009}, // Randomspawn 7
    {-1717.4703,397.4977,7.1797,230.0023}, // Randomspawn 8
    {-2536.6614,2289.7332,4.9844,154.8162} // Randomspawn 9
};
The problem is , even after following all the steps (all the onplayerspawn info) , you still dont have random spawns. Am I supposed to do anything here?
Like add the random1 2 3 thing in the "addplayerclass" ?

It just spawns in the place where "AddPlayerClass(1,2592.9792,2791.0059,10.8203,0,0, 0,0,0,0,0);" , so I never actually change the spawnpoint.
Reply
#2

I have just looked again, basically what happens is that the "addplayerclass" already has coordinates.
Is there a way I can make that random someway?

When I put

RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2]

in addplayerclass instead of x y z , it says "undefined simbol random"

So i dont know how I can get to make random spawns with all classes...
Reply
#3

This will help u:
pawn Код:
new Float:RandomSpawn[][10] =//10 is count the random spawns+1
{
    // Positions, (X, Y, Z and Facing Angle)
    {-1960.8276,-854.2136,32.2188,182.3284}, // Randomspawn 1
    {-2043.7568,-39.8849,35.4227,357.6480}, // Randomspawn 2
    {-2269.7905,220.2377,35.3153,174.5811}, // Randomspawn 3
    {-2649.6274,16.6343,6.1328,4.0869}, // Randomspawn 4
    {-2548.9504,814.3687,49.9844,189.6447}, // Randomspawn 5
    {-2655.3545,1348.3672,7.0954,285.7137}, // Randomspawn 6
    {-1843.6552,1087.6333,46.0781,355.9009}, // Randomspawn 7
    {-1717.4703,397.4977,7.1797,230.0023}, // Randomspawn 8
    {-2536.6614,2289.7332,4.9844,154.8162} // Randomspawn 9
}
public OnPlayerSpawn(playerid)
{
    new rand = random(sizeof(RandomSpawn));
 
    // SetPlayerPos to the random spawn data
    SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
 
    // SetPlayerFacingAngle to the random facing angle data
    SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
    return 1;
};
Reply
#4

Sorry but I keep on spawning in the "addplayerclass" coordinates. Am I supposed to change anything there?
Reply
#5

You dont need to change anything there. Try testing it with a clean script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)