Random spawn - 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 spawn (
/showthread.php?tid=632497)
Random spawn -
Despacito - 15.04.2017
I have this random spawn code:
pawn Код:
new Float:RandomUSACoords[10][3] =
{
(-219.5760,2704.1409,62.5391), // Random Usa Spawn 1
(-198.5659,2713.6584,62.5391), // Random Usa Spawn 2
(-247.3498,2678.3420,62.5391), // Random Usa Spawn 3
(-230.0754,2596.5901,62.5391), // Random Usa Spawn 4
(-236.6343,2597.4094,78.7681), // Random Usa Spawn 5
(-250.2850,2602.0071,67.3468), // Random Usa Spawn 6
(-296.3360,2713.4448,65.5440), // Random Usa Spawn 7
(-302.6953,2691.2366,62.6875), // Random Usa Spawn 8
(-166.2483,2720.6833,61.9878), // Random Usa Spawn 9
(-161.6798,2651.2500,80.1681) // Random Usa Spawn 10
};
OnPlayerSpawn:
pawn Код:
if(gTeam[playerid] == TEAM_USA)
{
SetRandomUSAPos(playerid);
}
pawn Код:
stock SetRandomUSAPos(playerid)
{
if( gTeam[playerid] == TEAM_USA )
{
new rand = random(sizeof(RandomUSACoords));
SetPlayerPos(playerid, RandomUSACoords[rand][0],RandomUSACoords[rand][1],RandomUSACoords[rand][2]);
}
return 1;
}
Can someone tell me why doesn't work? I dont get any error while compiling.
When i spawn, i spawn in a factory near LV bridge, i tried spawning multiple times and i always spawn there.
What's wrong?
Re: Random spawn -
GangstaSunny. - 15.04.2017
Leave it blank
PHP код:
new Float:RandomUSACoords[][] =
And use "{}" not "()"
Re: Random spawn -
Despacito - 15.04.2017
In that way doesn't work.
Re: Random spawn -
DarkSkull - 15.04.2017
Are you sure that you are from TEAM_USA?
Re: Random spawn -
Despacito - 15.04.2017
Ok now works, thanks.