Little Help
#1

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?
Reply
#2

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)