[Include] OnPlayerPause detection!
#5

I don't see your need for all those timers and health stuff?

pawn Код:
new PlayerUpdate[MAX_PLAYERS char], // less than 255 players, change it yourself if needed..
    Paused[MAX_PLAYERS];

forward OnPlayerPause(playerid);
forward OnPlayerUnPause(playerid);
forward IsPlayerPaused(playerid);

public IsPlayerPaused(playerid) return Paused[playerid];

public OnPlayerUpdate(playerid)
{
    if(PlayerUpdate{playerid} >= 2)
    {
        Paused[playerid] = 0;
        CallRemoteFunction("OnPlayerUnPause", "i", playerid);
    }
    PlayerUpdate{playerid} = 0;
    return 1;
}

public OnPlayerPause(playerid)
{
    printf("[System] - %s(%d) Has Paused", Playername(playerid), playerid);
    return 1;
}

public OnPlayerUnPause(playerid)
{
    printf("[System] - %s(%d) Has Unpaused", Playername(playerid), playerid);
    return 1;
}

// in a preferably 1 second timer

if(PlayerUpdate{i} < 2)
{
    PlayerUpdate{i}++;
}
else
{
    if(Paused[i] != 1)
    {
        CallRemoteFunction("OnPlayerPause", "i", i);
        Paused[i] = 1;
    }
}
Reply


Messages In This Thread
OnPlayerPause detection! - by FireCat - 01.08.2012, 16:53
Re: OnPlayerPause detection! - by Larceny - 01.08.2012, 17:05
Re: OnPlayerPause detection! - by FireCat - 01.08.2012, 17:05
Re: OnPlayerPause detection! - by Littlehelper - 01.08.2012, 17:06
Re: OnPlayerPause detection! - by Kar - 01.08.2012, 17:06
Re: OnPlayerPause detection! - by FireCat - 01.08.2012, 17:08
Re: OnPlayerPause detection! - by Maxips2 - 01.08.2012, 17:13
Re: OnPlayerPause detection! - by Kar - 01.08.2012, 17:14
Re: OnPlayerPause detection! - by Lorenc_ - 01.08.2012, 17:19
Re: OnPlayerPause detection! - by FireCat - 01.08.2012, 17:22
Re: OnPlayerPause detection! - by Rudy_ - 01.08.2012, 18:49
Re: OnPlayerPause detection! - by TheArcher - 02.08.2012, 17:09
Re: OnPlayerPause detection! - by FireCat - 02.08.2012, 18:26
Re: OnPlayerPause detection! - by TheArcher - 02.08.2012, 20:24
Re: OnPlayerPause detection! - by Kiets - 02.08.2012, 20:57

Forum Jump:


Users browsing this thread: 1 Guest(s)