SA-MP Forums Archive
Random Request Class Locations? - 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 Request Class Locations? (/showthread.php?tid=327437)



Random Request Class Locations? - FreshRio - 21.03.2012

Hi,

How do I create random Class Section Locations?



Thanks


Re: Random Request Class Locations? - MP2 - 21.03.2012

Create an array/enum structure to store all the possible locations, then use random().

enum should include

- Playerpos (x y z angle)
- Interior
- Camera pos (x y z)
- Camera 'lookat' pos (x y z)

Do you want it random for every skin, or do you mean a set skin for every class? If you mean random every time use ^


Re: Random Request Class Locations? - DarkScripter - 21.03.2012

Top Of GameMode
pawn Код:
new Float:Locations[4][10] =
{
    {PlayerPosX, PlayerPosY, PlayerPosZ, CamPosX, CamPosY, CamPosZ, LookPosX, LookPosY, LookPosZ, Angle},
    {PlayerPosX, PlayerPosY, PlayerPosZ, CamPosX, CamPosY, CamPosZ, LookPosX, LookPosY, LookPosZ, Angle},
    {PlayerPosX, PlayerPosY, PlayerPosZ, CamPosX, CamPosY, CamPosZ, LookPosX, LookPosY, LookPosZ, Angle},
    {PlayerPosX, PlayerPosY, PlayerPosZ, CamPosX, CamPosY, CamPosZ, LookPosX, LookPosY, LookPosZ, Angle},
    {PlayerPosX, PlayerPosY, PlayerPosZ, CamPosX, CamPosY, CamPosZ, LookPosX, LookPosY, LookPosZ, Angle}
};
[b]In OnPlayerRequestClass
pawn Код:
new rand = random(sizeof(Locations));
    SetPlayerPos(playerid, Locations[rand][0], Locations[rand][1], Locations[rand][2]);
    SetPlayerCameraPos(playerid, Locations[rand][3], Locations[rand][4], Locations[rand][5]);
    SetPlayerCameraLookAt(playerid, Locations[rand][6],Locations[rand][7], Locations[rand][8]);
    SetPlayerFacingAngle(playerid, Locations[rand][9]);



Re: Random Request Class Locations? - FreshRio - 21.03.2012

I mean, Different Locations on every connection. Not by skin changes.

@DarkScripter, It works but once again I wanted it ^^

Thanks


Re: Random Request Class Locations? - FreshRio - 22.03.2012

Bump, Anyone?


Re: Random Request Class Locations? - cs_waller - 22.03.2012

Try to paste DarkScripter's code in callback OnPlayerSpawn it's should work


Re: Random Request Class Locations? - FreshRio - 22.03.2012

there is not way that would work.