Whats wrong with Afk Check?
#4

pawn Код:
new
     LastUpdate[MAX_PLAYER],
     Text3D:Paused[MAX_PLAYERS];


public OnGameModeInti()
{
   SetTimer("Paused",1000, 1);
   return 1;
}

public OnPlayerUpdate(playerid)
{
   LastUpdate[playerid] = gettime();
   return 1;
}

forward Paused(playerid);
public Paused(playerid)
{
   for(new i = 0; i < MAX_PLAYERS; i++)
   {
       if(gettime() - LastUpdate[i] >=5)
       {
           Paused[i] = Create3DTextLabel("Paused",-1,30.0,40.0,50.0,40.0,0);
           Attach3DTextLabelToPlayer(Paused[i], playerid, 0.0, 0.0, 0.7);
       }
       else
       {
           Delete3DTextLabel(Paused[i]);
       }  
   }
   return 1;
}
I guess it's better using a custom 1 second timer than putting this code into OnPlayerUpdate.
Reply


Messages In This Thread
Whats wrong with Afk Check? - by Admigo - 14.04.2012, 18:48
Re: Whats wrong with Afk Check? - by mineralo - 14.04.2012, 19:02
Re: Whats wrong with Afk Check? - by Admigo - 14.04.2012, 19:12
Re: Whats wrong with Afk Check? - by Cypress - 14.04.2012, 19:22
Re: Whats wrong with Afk Check? - by Admigo - 14.04.2012, 23:10
Re: Whats wrong with Afk Check? - by MP2 - 14.04.2012, 23:16
Re: Whats wrong with Afk Check? - by FalconX - 14.04.2012, 23:30
Re: Whats wrong with Afk Check? - by MP2 - 14.04.2012, 23:34
Re: Whats wrong with Afk Check? - by FalconX - 14.04.2012, 23:37
Re: Whats wrong with Afk Check? - by Admigo - 15.04.2012, 06:49

Forum Jump:


Users browsing this thread: 4 Guest(s)