Help - InterpolateCamera
#1

Good evening, I'm kind of sad and angry, today I was all day in just a fucking [B] InterpolateCamera [/ B], is as follows, I have these following coordinates ..


PHP код:
InterpolateCameraPos(playerid2365.8767, -1485.5969,75.79182132.2759, -941.1163,109.6049 10000);
InterpolateCameraLookAt(playerid2132.8271, -974.1696,108.34671720.5673, -1203.7601,113.5448 10000); 
and above this function:

PHP код:
TogglePlayerSpectating (playeridtrue); 
PHP код:
public OnPlayerRequestClass (playeridclassid)
{
TogglePlayerSpectating (playeridtrue);
InterpolateCameraPos (playerid2365.8767, -1485.5969,75.79182132.2759, -941.1163,109.6049 10000);
InterpolateCameraLookAt (playerid2132.8271, -974.1696,108.34671720.5673, -1203.7601,113.5448 10000);
// Just below, shows the dialogue login and registration (I think not need to show)
// I've tried to put the above code in OnplayerConect, plus the screen lock all ..

My problem is that when a person logs on the server, it is close to the above coordinates, for example, the camera walked and when the player gives the spawn, it is in that position, the last place where the camera InterpolateCameraPos stood, instead the player go to normal spawn, which is his HQ organization, he is flying in the sky and then immediately falls and dies .. of course .. do not know the solution, researched, tried (WIKI ) and I found, did everything, even plagiarism of coordinated I try, nothing else would I want to solve this soon, but with your help urgently, to me is already complex.

I will show just enough of my public OnPlayerLogin
PHP код:
public OnPlayerLogin(playeridpassword [])
{
TogglePlayerSpectating (playeridfalse);
SetSpawnInfo(playerid0PlayerInfo [playerid] [pchar], 1447.7323, -1663.101013.55301.0, -1, -1, -1, -1, -1, -1);
SpawnPlayer(playerid);

Why the public? By then immediately after the dialogue, is where the player takes the first spawn after login, do not know where you put it, because this TogglePlayerSpectating angered me today, this bug once (0.3C) many people had (I think), we see if the board're helping you need right ..

In OnPlayerSpawn has only coordinates where the player will take the spawn, ie in its HQ ..
Reply
#2

Well first of all, you should probably use the OnPlayerConnect callback rather than the OnPlayerRequestClass callback. (I would recommend setting a timer in OnPlayerConnect rather than calling InterpolateCameraPos straight away)

Also, TogglePlayerSpectating to false also triggers OnPlayerSpawn, so in your OnPlayerLogin function, you are actually spawning the player twice.

pawn Код:
public OnPlayerConnect(playerid)
{
    TogglePlayerSpectating(playerid, true);
    SetTimerEx("BeginCamera", 500, false, "i", playerid);
    // Show login/register dialog
    return 1;
}

forward BeginCamera(playerid);
public BeginCamera(playerid)
{
    InterpolateCameraPos(playerid, 2365.8767, -1485.5969, 75.7918, 2132.2759, -941.1163, 109.6049, 10000, CAMERA_MOVE);
    InterpolateCameraLookAt(playerid, 2132.8271, -974.1696, 108.3467, 1720.5673, -1203.7601, 113.5448, 10000, CAMERA_MOVE);
    return 1;
}

forward OnPlayerLogin(playerid);
public OnPlayerLogin(playerid)
{
    SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pchar], 1447.7323, -1663.1010, 13.5530, 1.0, -1, -1, -1, -1, -1, -1);
    TogglePlayerSpectating(playerid, false);
    return 1;
}
I'm not even sure if the timer is necessary, but it's worth a shot nonetheless. You were also missing parameters for your InterpolateCameraPos and InterpolateCameraLookAt functions, so the camera wouldn't even move at all...

References:
https://sampwiki.blast.hk/wiki/InterpolateCameraPos
https://sampwiki.blast.hk/wiki/InterpolateCameraLookAt
https://sampwiki.blast.hk/wiki/TogglePlayerSpectating
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)