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



Need help with random spawn - BASITJALIL - 25.04.2011

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



AW: Need help with random spawn - xerox8521 - 25.04.2011

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]);



Re: Need help with random spawn - Alby Fire - 25.04.2011

Deleted


Re: Need help with random spawn - BASITJALIL - 25.04.2011

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.



Re: AW: Need help with random spawn - CraZy_KiLLaH - 25.04.2011

Edit: Never mind, I was wrong


Re: Need help with random spawn - BASITJALIL - 25.04.2011

Still the previous error


AW: Re: AW: Need help with random spawn - xerox8521 - 25.04.2011

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...


Re: Need help with random spawn - BASITJALIL - 25.04.2011

Код:
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};
};



AW: Need help with random spawn - xerox8521 - 25.04.2011

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


Re: Need help with random spawn - BASITJALIL - 25.04.2011

I Did every thing you told


Re: Need help with random spawn - bartje01 - 25.04.2011

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;
}



Re: Need help with random spawn - BASITJALIL - 25.04.2011

Thanks alot dude


Re: Need help with random spawn - bartje01 - 25.04.2011

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