AFK System
#1

Hello, can anyone make me a AFK System where admins can tipe /afk and they can see what players is on afk and how long.

Sorry for my bad English
Reply
#2

pawn Код:
// On top of your script
new playerAFKCount[MAX_PLAYERS]; // ->Var

// On OnPlayerUpdate(playerid);
public OnPlayerUpdate(playerid)
{
    playerAFKCount[playerid] = gettime(); //Unix-timestamp.
    return 1;
}

// In your /afk command
new afkSeconds = (((playerAFKCount[id] - gettime()) / 60) / 1000); // This should return you the seconds count of how much a player is afk.
Pretty simple usage, I am not 100% about the afkSeconds. gettime() is a unix-timestamp, I've just converted it as milliseconds, hope I am correct.

If you need me to explain this to you, just tell me.
Reply
#3

I got these errors :/
Quote:

C:\Users\Tadas\Desktop\Serveris\gamemodes\naujas.p wn(7) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Tadas\Desktop\Serveris\gamemodes\naujas.p wn(7) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Tadas\Desktop\Serveris\gamemodes\naujas.p wn(737) : error 003: declaration of a local variable must appear in a compound block
C:\Users\Tadas\Desktop\Serveris\gamemodes\naujas.p wn(737) : error 017: undefined symbol "afkSeconds"
C:\Users\Tadas\Desktop\Serveris\gamemodes\naujas.p wn(737) : error 017: undefined symbol "id"
C:\Users\Tadas\Desktop\Serveris\gamemodes\naujas.p wn(737) : fatal error 107: too many error messages on one line

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)