Freeze not working just after spawning.
#1

Could something block TogglePlayerControllable effects in OnPlayerSpawn/just after it? For some reason players don't freeze but the native gets called.

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;
}
Custom function (Tried with and without timer):
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);
Edit: Found the problem, spawning just takes so many time the freeze ends before.
Reply
#2

My freeze time looks a bit difrent, maybe that will help with spawn time
Quote:

forward Unfreeze(playerid);
public OnPlayerSpawn(playerid)
{
LoadObjectsForPlayer( playerid );
TogglePlayerControllable(playerid, false); // Zamra?a gracza
SetTimerEx("Unfreeze", 5000, false, "i", playerid); // Robi odmro?enie gracza po 5 sekudnach!
return 1;
}

public Unfreeze(playerid)
{
TogglePlayerControllable(playerid, true); // Odmra?a gracza po 5 sekudnach!
return 1;
}

public LoadObjectsForPlayer( playerid )
{
if( IsPlayerConnected ( playerid ) )
{
TogglePlayerControllable( playerid, false ); // Freeze

if( GetPlayerPing ( playerid ) < 100 ) { SetTimerEx( "ObjectsLoaded", 3000, 0, "e", playerid ); } // jesli ping gracza mniejszy niz 100 zamraza na 3sekundy
else if( GetPlayerPing ( playerid ) > 100 ) { SetTimerEx( "ObjectsLoaded", 3000, 0, "e", playerid ); } // jesli ping gracza wiekszy niz 100 zamraza na 3sekundy
else if( GetPlayerPing ( playerid ) > 200 ) { SetTimerEx( "ObjectsLoaded", 3200, 0, "e", playerid ); } //jesli ping gracza wiekszy niz 200 zamraza na 3sekundy
else if( GetPlayerPing ( playerid ) > 300 ) { SetTimerEx( "ObjectsLoaded", 3700, 0, "e", playerid ); } //jesli ping gracza wiekszy niz 300 zamraza na 3.7sekundy
else if( GetPlayerPing ( playerid ) > 500 ) { SetTimerEx( "ObjectsLoaded", 4000, 0, "e", playerid ); } //jesli ping gracza wiekszy niz 500 zamraza na 4sekundy
else { SetTimerEx( "ObjectsLoaded", 5000, 0, "e", playerid ); }
}
return ( 1 );
}

public ObjectsLoaded(playerid)
{
if( IsPlayerConnected ( playerid ) ) return TogglePlayerControllable( playerid, true ), PlayerPlaySound( playerid, 1056, 0.0, 0.0, 0.0 );
return ( 1 );
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)