AFK system
#1

I'm trying to make a AFK system but it wont count the seconds a player is afk it only creates the chat bubble above the persons head.

PHP код:

public OnPlayerPause(playerid)
{
    foreach(new 
Player)
    {
        new 
iAFK[75];
        
format(iAFKsizeof(iAFK), "%s(%d) [Paused: %s secs]"ReturnPlayerName(i), inumber_format(playerData[i][pAFK]));
        
SetPlayerChatBubble(iiAFKCOLOR_SERVER50.010000);
          
CountAFK(i);
    }
    return 
1;
}
forward CountAFK(playerid);
public 
CountAFK(playerid)
{
//    for (new i = 0; i <= MAX_PLAYERS; i++)
//    {
          
if (IsPlayerInGame(playerid) || playerData[playerid][pd_IsLoggedIn])
        {
            if(!
playerData[playerid][pd_IsOnDuty])
            {
                
playerData[playerid][pAFK]++;
            }
         }
    
//}
    
return 1;
}
stock bool:IsPlayerAFK(playerid)
{
    if(
playerData[playerid][pAFK] >= 5) return true;
    return 
false;
}
stock number_formatnum )
{
    new 
stri[16], stro[16], ivpdlnum 0;
    
formatstrisizeofstri ), "%d"num * ( ? -) );
    
strlenstri ) - 1;
    
= ( - ( ) ) / 3;
    
1;
    
d;
    
l;
    while ( 
>= )
    {
        
i;
        if ( 
&& !( ) ) stro[n] = ',';
        else 
stro[n] = stri[p--];
         
i--;
    }
    
stro[0] = '-' stro[0];
    return 
stro;

Reply


Messages In This Thread
AFK system - by 1fret - 25.03.2018, 03:43
Re: AFK system - by Kane - 25.03.2018, 04:24
Re: AFK system - by Gammix - 25.03.2018, 04:45
Re: AFK system - by 1fret - 25.03.2018, 06:22

Forum Jump:


Users browsing this thread: 1 Guest(s)