07.06.2015, 04:41
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.
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
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;
}
References:
https://sampwiki.blast.hk/wiki/InterpolateCameraPos
https://sampwiki.blast.hk/wiki/InterpolateCameraLookAt
https://sampwiki.blast.hk/wiki/TogglePlayerSpectating