01.04.2014, 16:35
Could something block TogglePlayerControllable effects in OnPlayerSpawn/just after it? For some reason players don't freeze but the native gets called.
OnPlayerSpawn:
Custom function (Tried with and without timer):
Edit: Found the problem, spawning just takes so many time the freeze ends before.
OnPlayerSpawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
if (justlogitud[playerid])
{
SetPlayerInterior(playerid, KasutajaInfo[playerid][mInterior]);
SetPlayerVW(playerid, KasutajaInfo[playerid][mVW]);
SetPlayerPosWithFreeze(playerid, KasutajaInfo[playerid][mPos][0], KasutajaInfo[playerid][mPos][1], KasutajaInfo[playerid][mPos][2]);
SetPlayerFacingAngle(playerid, KasutajaInfo[playerid][mPos][3]);
SetPlayerHealth(playerid, KasutajaInfo[playerid][mElud]);
SetPlayerArmour(playerid, KasutajaInfo[playerid][mArmor]);
GivePlayerWeapons(playerid);
justlogitud[playerid] = false;
}
return 1;
}
pawn Код:
stock SetPlayerPosWithFreeze(playerid, Float:x, Float:y, Float:z)
{
new aeg = 3000 + GetPlayerPing(playerid);
unfreezetimer[playerid] = GetTickCount() + aeg;
SetTimerEx("Freeze", 1000, false, "i", playerid);
GameTextForPlayer(playerid, "Objekte laetakse, ~n~palun oota!", aeg, 6);
SetPlayerPos(playerid, x, y, z);
return 1;
}
func Freeze(playerid) return TogglePlayerControllable(playerid, false);