open.mp forum
[Pawn] Why random spawn doesnot want to work? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] Why random spawn doesnot want to work? (/showthread.php?tid=2415)



Why random spawn doesnot want to work? - abdr37888 - 2023-06-25

Code:
new Float:RandomSpawnGrove[4][4] = {
{2225.7131,-1149.6176,1025.7969,95.7851},
{2246.0417,-1190.8867,1029.7969,25.5977},
{2191.7427,-1189.8916,1029.7969,261.2032},
{2193.6560,-1142.0361,1029.7969,178.7957}
};


public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerColor(playerid) == COLOR_GREEN)
{
new rand = random(sizeof(RandomSpawnGrove));
AddPlayerClass(106,RandomSpawnGrove[rand][0],RandomSpawnGrove[rand][1],RandomSpawnGrove[rand][2],RandomSpawnGrove[rand][3],0,0,0,0,0,0);
}
return 1;
}

I didnot get any error when compile when i died and my color green it didnot spawn in the random spawn.
Whats wrong?

Plzz anyone help me.


RE: Why random spawn doesnot want to work? - DevianTyr - 2023-06-26

Use SetSpawnInfo and SpawnPlayer