Need help with random spawn
#1

Hey all i want help with random spawn
When i made them it give's me alot error's can you please make the spawns for me
Positions
Код:
AddPlayerClass(0,622.2733,892.5632,-35.2678,332.7885,0,0,0,0,0,0); // Pos1
AddPlayerClass(0,682.1865,836.6607,-42.9609,235.6544,0,0,0,0,0,0); // Pos2
AddPlayerClass(0,540.3431,840.1038,-41.1784,100.0032,0,0,0,0,0,0); // Pos2
AddPlayerClass(0,466.4939,888.5435,-28.5861,246.7895,0,0,0,0,0,0); // Pos4
Reply
#2

it will gives much erros as your adding the CJ skin like 4 times....
As far as i know you can do it only once per skin id
pawn Код:
// Add this somewhere under the includes
new Float:SpawnPoints[4][4] =
{
{622.2733,892.5632,-35.2678,332.7885,
{682.1865,836.6607,-42.9609,235.6544},
{540.3431,840.1038,-41.1784,100.0032},
{466.4939,888.5435,-28.5861,246.7895}
};
OnPlayerSpawn

pawn Код:
new rnd;
            rnd = random(sizeof (SpawnPoints));
            SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]);
            SetPlayerFacingAngle(playerid, SpawnPoints[rnd][3]);
Reply
#3

Deleted
Reply
#4

2 Errors
Код:
D:\Gta\Pwano\gamemodes\Gungame.pwn(11) : error 008: must be a constant expression; assumed zero
D:\Gta\Pwano\gamemodes\Gungame.pwn(14) : error 001: expected token: "}", but found ";"
D:\Gta\Pwano\gamemodes\Gungame.pwn(76) : warning 217: loose indentation
D:\Gta\Pwano\gamemodes\Gungame.pwn(78) : warning 217: loose indentation
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#5

Edit: Never mind, I was wrong
Reply
#6

Still the previous error
Reply
#7

Quote:
Originally Posted by CraZy_KiLLaH
Посмотреть сообщение
Isnt it like this

Correct me if Iam wrong
nope it isnt because its defined as you need to enter 4 coords else it will give you errors


//Edit: @BASITJALIL

Post the lines where the errors are...
Reply
#8

Код:
D:\Gta\Pwano\gamemodes\Gungame.pwn(10) : error 001: expected token: "}", but found ";"
D:\Gta\Pwano\gamemodes\Gungame.pwn(14) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Here
pawn Код:
{622.2733,892.5632,-35.2678,332.7885};
};
Reply
#9

Quote:
Originally Posted by xerox8521
Посмотреть сообщение
it will gives much erros as your adding the CJ skin like 4 times....
As far as i know you can do it only once per skin id
pawn Код:
// Add this somewhere under the includes
new Float:SpawnPoints[4][4] =
{
{622.2733,892.5632,-35.2678,332.7885,
{682.1865,836.6607,-42.9609,235.6544},
{540.3431,840.1038,-41.1784,100.0032},
{466.4939,888.5435,-28.5861,246.7895}
};
OnPlayerSpawn

pawn Код:
new rnd;
            rnd = random(sizeof (SpawnPoints));
            SetPlayerPos(playerid, SpawnPoints[rnd][0], SpawnPoints[rnd][1], SpawnPoints[rnd][2]);
            SetPlayerFacingAngle(playerid, SpawnPoints[rnd][3]);
As i already posted use these things here
Reply
#10

I Did every thing you told
Reply
#11

My random spawn is like this:

pawn Код:
new Float:RandomSpawn[][5] =
{
    // Positions, (X, Y, Z and Facing Angle)
    {1827.8083,-1858.1565,13.5781,90.8463},
    {1221.8761,-1816.1857,16.5938,179.5371},
    {2227.1499,-1159.4750,25.7790,89.5271},
    {670.9753,-1261.9874,13.6250,359.4768}
};
pawn Код:
public OnPlayerSpawn(playerid)
{
   

    new rand = random(sizeof(RandomSpawn));
    SetPlayerPos(playerid, RandomSpawn[rand][0], RandomSpawn[rand][1],RandomSpawn[rand][2]);
    SetPlayerFacingAngle(playerid, RandomSpawn[rand][3]);
    return 1;
}
Reply
#12

Thanks alot dude
Reply
#13

No problem. Just ask if you're still walking into problems
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)