need help with angles . (randomspawns)
#1

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

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); 
Reply
#3

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
Reply
#4

Doesn't work ;/
Reply
#5

Elaborate..
Reply
#6

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

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
Reply
#8

GetPlayerFacingAngle(playerid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)