SA-MP Forums Archive
Random spawns not working - 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)
+--- Thread: Random spawns not working (/showthread.php?tid=307076)



Random spawns not working - XxCozzaxX - 29.12.2011

Can someone spot the issue? It should work, but the SetPlayerPos line is not functioning?
i.e. The player does not get moved on spawn, and instead goes to the AddPlayerClass coordinates.

Код:
new Float:Spawns[][] =
{
	{4171.79980469,-2095.80004883,68.59999847,182.00000000},
	{4179.79980469,-2096.10009766,68.59999847,169.99945068},
	{4188.70019531,-2099.60009766,68.59999847,149.99682617},
	{4196.00000000,-2104.69995117,68.59999847,139.99633789},
	{4201.89990234,-2110.80004883,68.59999847,117.99316406},
	{4206.50000000,-2117.69995117,68.59999847,109.99316406},
	{4208.29980469,-2125.00000000,68.59999847,95.98950195},
	{4207.89990234,-2133.10009766,68.59999847,83.98754883},
	{4205.50000000,-2142.39990234,68.59999847,69.98498535},
	{4201.60009766,-2151.19995117,68.59999847,47.98291016},
	{4195.70019531,-2157.60009766,68.59999847,35.98278809},
	{4187.60009766,-2162.60009766,68.59999847,15.98022461},
	{4180.00000000,-2164.39990234,68.59999847,3.97961426},
	{4171.89990234,-2164.89990234,68.59999847,349.97961426},
	{4164.00000000,-2163.60009766,68.59999847,339.97497559},
	{4157.00000000,-2160.60009766,68.59999847,327.97192383},
	{4151.10009766,-2156.39990234,68.59999847,315.96936035},
	{4146.29980469,-2151.60009766,68.59999847,303.96679688},
	{4142.39990234,-2145.00000000,68.59999847,291.96423340},
	{4140.39990234,-2137.60009766,68.59999847,277.96166992},
	{4139.60009766,-2130.39990234,68.59999847,267.95959473},
	{4140.79980469,-2122.19995117,68.59999847,249.95654297},
	{4144.00000000,-2114.10009766,68.59999847,235.95544434},
	{4148.20019531,-2108.00000000,68.59999847,221.95336914},
	{4153.70019531,-2102.80004883,68.59999847,211.95129395},
	{4159.10009766,-2099.19995117,68.59999847,199.94824219},
	{4165.29980469,-2096.89990234,68.59999847,193.94567871}
};
Код:
public OnPlayerSpawn(playerid)
{
    new Random = 0;
    Random = random(sizeof(Spawns));
    SetPlayerPos(playerid, Spawns[Random][0], Spawns[Random][1], Spawns[Random][2]);
    SetPlayerFacingAngle(playerid, Spawns[Random][3]);
    return 1;
}
If anyone knows the solution, I'd love to hear it!

Regards,
Cozza


Re: Random spawns not working - jamesbond007 - 29.12.2011

try this..

pawn Код:
new Float:Spawns[][4] = {



Re: Random spawns not working - Ballu Miaa - 29.12.2011

I guess this one!

pawn Код:
new Float:Spawns[27][4] = { //Check you spawn point's! Are those 27 or 26? Correct it if its not.



Re: Random spawns not working - XxCozzaxX - 29.12.2011

I tried this earlier and it didn't work. I will try again when I get home. Another thing worth mentioning is that when setplayerpos coordinates are changed to 0,0,0 - the player is still not teleported. Thanks in advance, cozza