How can i make player freeze on spawn for about 5 seconds?
#1

Hello.

I was wondering, that im using a LARP GM to edit my RP server, and im using custom map in it. I want players to spawn on that map, but often they will fall throught the map. How can i freeze them so objects would load, and they wont fall throught the map?!

I really need some help right now.. I dont know anything about timers.
Reply
#2

Freeze them, start a timer and when the timer ends unfreeze them.
pawn Код:
TogglePlayerControllable(playerid, 1);
SetTimerEx("UnfreezeMe", "i", playerid);
//...
public UnfreezeMe(playerid)
{
    TogglePlayerControllable(playerid, 0);
}
Reply
#3

Add this:
pawn Код:
public LoadObjectsForPlayer( playerid )
{
    if( IsPlayerConnected ( playerid ) )
    {
        TogglePlayerControllable( playerid, false ); // Freeze

        if( GetPlayerPing ( playerid ) < 100 )      { SetTimerEx( "ObjectsLoaded", 3000, 0, "e", playerid ); }
        else if( GetPlayerPing ( playerid ) > 100 ) { SetTimerEx( "ObjectsLoaded", 3000, 0, "e", playerid ); }
        else if( GetPlayerPing ( playerid ) > 200 ) { SetTimerEx( "ObjectsLoaded", 3200, 0, "e", playerid ); }
        else if( GetPlayerPing ( playerid ) > 300 ) { SetTimerEx( "ObjectsLoaded", 3700, 0, "e", playerid ); }
        else if( GetPlayerPing ( playerid ) > 500 ) { SetTimerEx( "ObjectsLoaded", 4000, 0, "e", playerid ); }
        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 );
}
and this at OnPlayerSpawn:
pawn Код:
LoadObjectsForPlayer( playerid );
Reply
#4

pawn Код:
public OnPlayerSpawn(playerid)
{
    TogglePlayerControllable(playerid, false); // Freeze the player
    SetTimerEx("Unfreeze", 5000, false, "i", playerid); // Make a 5 second timer for that player to get unfrozen
    return 1;
}

forward Unfreeze(playerid);
public Unfreeze(playerid)
{
    TogglePlayerControllable(playerid, true); // Unfreeze the player after 5 seconds
    return 1;
}
Reply
#5

Well, i used the system aRoach gaved, and i got those warnings:

pawn Код:
C:\Documents and Settings\Microsoft\Desktop\GMRP\gamemodes\GMRP.pwn(1825) : warning 235: public function lacks forward declaration (symbol "LoadObjectsForPlayer")
C:\Documents and Settings\Microsoft\Desktop\GMRP\gamemodes\GMRP.pwn(1841) : warning 235: public function lacks forward declaration (symbol "ObjectsLoaded")
pawn Код:
Line 1825: public LoadObjectsForPlayer( playerid )
Line 1841: public ObjectsLoaded(playerid)
Reply
#6

Put this at the top of Script:
pawn Код:
forward LoadObjectsForPlayer( playerid );
forward ObjectsLoaded( playerid );
Reply
#7

Quote:
Originally Posted by aRoach
Посмотреть сообщение
Put this at the top of Script:
pawn Код:
forward LoadObjectsForPlayer( playerid );
forward ObjectsLoaded( playerid );
Thanks . +rep for you :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)