Little help.
#1

I've created moving camera in Class Selection. It's working fine, i spawn player it spawns BUT when i choose some other player class like the second one, the player doesn't spawns and the camera gets still on the Class Selection. The first player class is spawned correctly but the other ones are not spawning -.- Anybody can tell me, what i can do with it?
Reply
#2

Show code?
Reply
#3

Pretty sure it's code related problem. We can't help you if you don't show us some part of your code.
Reply
#4

This is at OnPlayerRequestClass

pawn Код:
PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid);
This is the callback i created
pawn Код:
forward MoveCamera(playerid);
public MoveCamera(playerid)
{
    SetPlayerCameraPos(playerid, player_x - 2 * floatsin(-PlayerInfo[playerid][SpawnAngle], degrees), player_y - 10 * floatcos(-PlayerInfo[playerid][SpawnAngle], degrees), player_z + 3);
    SetPlayerCameraLookAt(playerid, player_xE, player_yE, player_zE + 0.5);
    PlayerInfo[playerid][SpawnAngle] += 0.5;
    if (PlayerInfo[playerid][SpawnAngle] >= 360.0)
        PlayerInfo[playerid][SpawnAngle] = 0.0;
}
This is at my OnPlayerSpawn

pawn Код:
PlayerInfo[playerid][SpawnAngle] = 0.0;
    KillTimer( PlayerInfo[playerid][SpawnTimer] ); //to kill it, since its useless now
    new r = random(sizeof(spawns));
    SetPlayerPos(playerid, spawns[r][ex], spawns[r][ey], spawns[r][ez]);
    SetPlayerInterior(playerid, spawns[r][interior]);
    SendClientMessage(playerid, COLOR_WHITE, spawns[r][emsg]);
Reply
#5

Nevermind...
This code looks fine provided all the variables are correct.
Try adding KillTimer(PlayerInfo[playerid][SpawnTimer]); above PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid); in OnPlayerRequestClass
and change the code in OnPlayerSpawn to OnPlayerRequestSpawn
Reply
#6

Quote:
Originally Posted by TheLazySloth
Посмотреть сообщение
Nevermind...
This code looks fine provided all the variables are correct.
Try adding KillTimer(PlayerInfo[playerid][SpawnTimer]); above PlayerInfo[playerid][SpawnTimer] = SetTimerEx("MoveCamera", moving_speed, true, "i", playerid); in OnPlayerRequestClass
and change the code in OnPlayerSpawn to OnPlayerRequestSpawn
Worked! Thank you. +rep for ya
Reply
#7

You're welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)