SA-MP Forums Archive
Little Help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Little Help (/showthread.php?tid=225675)



Little Help - Libra_PL - 14.02.2011

Hey. I got a little problem with random spawn, I got only warnings (no errors). Here's code:

Код:
new Float:RandomSpawn[][4] = {
    {419.800018,2531.705322,16.157726,180},
    {2041.805,-3113.831,7.442,180},
    {1319.23620600,1254.57458500,10.37386700,0}
};
Код:
public OnPlayerSpawn(playerid)
{
	new rands = random(sizeof(RandomSpawn));
    SetPlayerPos(playerid, RandomSpawn[rands][0], RandomSpawn[rands][1], RandomSpawn[rands][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rands][3]);
	return 1;
}
And the problem is tag mismatch in the coordinates. Can anyone change it to no-warnings code?


Re: Little Help - -Rebel Son- - 14.02.2011

Код:
new Float:RandomSpawn[][3] = {
    {419.800018,2531.705322,16.157726,},
    {2041.805,-3113.831,7.442,},
    {1319.23620600,1254.57458500,10.37386700,}
};



Re: Little Help - (SF)Noobanatior - 14.02.2011

Rebel son that is horrible code try this and i would also go
pawn Код:
#define MAX_RSPAWNS 3
new Float:RandomSpawn[MAX_RSPAWNS][4] = {
    {419.800018,2531.705322,16.157726,180.0},
    {2041.805,-3113.831,7.442,180.0},
    {1319.23620600,1254.57458500,10.37386700,0.0}
};
pawn Код:
public OnPlayerSpawn(playerid)
{
    new rands = random(MAX_RSPAWNS);
    SetPlayerPos(playerid, RandomSpawn[rands][0], RandomSpawn[rands][1], RandomSpawn[rands][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rands][3]);
    return 1;
}
btw your facing angles need to be floats not intgers that is the mis match