SA-MP Forums Archive
need help with angles . (randomspawns) - 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: need help with angles . (randomspawns) (/showthread.php?tid=415542)



need help with angles . (randomspawns) [SOLVED] - Immortal_LTU - 13.02.2013

Hi , i don't know how to set facing angle . I'm making random spawns

here's the script :

Код:
new Float:RandomSpawnai[][4] =
{
{-478.0667,2194.6909,42.9554}, 
{-478.0667,2194.6909,42.9554}
};
OnPlayerSpawn Callback

Код:
new rand = random(sizeof(RandomSpawnai));
SetPlayerPos(playerid, RandomSpawnai[rand][0], RandomSpawnai[rand][1],RandomSpawnai[rand][2]);
so how do i can set the angle ?


Re: need help with angles . (randomspawns) - S0n1COwnsYou - 13.02.2013

instead of this
Quote:

new Float:RandomSpawnai[][4] =
{
{-478.0667,2194.6909,42.9554},
{-478.0667,2194.6909,42.9554}
};

try this,
PHP код:
    new Float:RandomSpawnai[][4] =
    {
        {
XYZAngle}
    };
    new 
rand random(sizeof(RandomSpawnai));
    
SetPlayerPos(playeridRandomSpawnai[rand][0], RandomSpawnai[rand][1],RandomSpawnai[rand][2]);
    
SetPlayerFacingAngle(playeridRandomSpawnai[rand][3]);
    
SetCameraBehindPlayer(playerid); 



Re: need help with angles . (randomspawns) - Jstylezzz - 13.02.2013

pawn Код:
new Float:RandomSpawnai[][5] =
{
{-478.0667,2194.6909,42.9554,angle},
{-478.0667,2194.6909,42.9554,angle}
};
new rand = random(sizeof(RandomSpawnai));
SetPlayerPos(playerid, RandomSpawnai[rand][0], RandomSpawnai[rand][1],RandomSpawnai[rand][2]);
SetPlayerFacingAngle(playerid,RandomSpawnai[rand][3]);
I think it's something like this


Re: need help with angles . (randomspawns) - Immortal_LTU - 13.02.2013

Doesn't work ;/


Re: need help with angles . (randomspawns) - MP2 - 13.02.2013

Elaborate..


Re: need help with angles . (randomspawns) - Patrick - 13.02.2013

Something Like this, i explain it. if you dont understand just tell me, ill try explain it more.

pawn Код:
new Float:RandomSpawns[/*Ammounts of random spawn point you setted = 1*/1][/*Ammount of x,y,z,rotation = 4*/4] =
{//opens
//To make 1 make sure you have X,Y,Z Coords and also Rotation coords for SetPlayerFacingAngle
{/*X*/1188.7582,/*Y*/-1325.9576,/*Z*/13.5674,/*Rotation*/270.0026} //if you everytime add one make sure you put "comma ," and always remember dont put "comma ," at end
};//closes

public OnPlayerSpawn(playerid)
{
    new spawnpoints = random(sizeof(SpawnPoints));/*it will call random spawn points*/
    SetPlayerPos(playerid,RandomSpawns[spawnpoints][0],RandomSpawns[spawnpoints][1],RandomSpawns[spawnpoints][2]);/*SetPlayerPos to your XYZ coords you made*/
    SetPlayerFacingAngle(playerid,RandomSpawns[spawnpoints][3]);/*Rotation Or Angel*/
    SetCameraBehindPlayer(playerid);/*Sets Camera Behind The Player*/
    return 1;
}



Re: need help with angles . (randomspawns) [SOLVED] - Immortal_LTU - 14.02.2013

Quote:
Originally Posted by pds2012
Посмотреть сообщение
Something Like this, i explain it. if you dont understand just tell me, ill try explain it more.

pawn Код:
new Float:RandomSpawns[/*Ammounts of random spawn point you setted = 1*/1][/*Ammount of x,y,z,rotation = 4*/4] =
{//opens
//To make 1 make sure you have X,Y,Z Coords and also Rotation coords for SetPlayerFacingAngle
{/*X*/1188.7582,/*Y*/-1325.9576,/*Z*/13.5674,/*Rotation*/270.0026} //if you everytime add one make sure you put "comma ," and always remember dont put "comma ," at end
};//closes

public OnPlayerSpawn(playerid)
{
    new spawnpoints = random(sizeof(SpawnPoints));/*it will call random spawn points*/
    SetPlayerPos(playerid,RandomSpawns[spawnpoints][0],RandomSpawns[spawnpoints][1],RandomSpawns[spawnpoints][2]);/*SetPlayerPos to your XYZ coords you made*/
    SetPlayerFacingAngle(playerid,RandomSpawns[spawnpoints][3]);/*Rotation Or Angel*/
    SetCameraBehindPlayer(playerid);/*Sets Camera Behind The Player*/
    return 1;
}
Thanks for the help ! I figure it out


Re: need help with angles . (randomspawns) - Da_Noob - 14.02.2013

GetPlayerFacingAngle(playerid);