CMD:afk(playerid,params[]) { new name[MAX_PLAYER_NAME]; new str[128]; TextDrawShowForPlayer(playerid, Textdraw3); TextDrawShowForPlayer(playerid, Textdraw5); GetPlayerName(playerid,name,sizeof(name)); GetPlayerPos(playerid,xpos,ypos,zpos); ainterior = GetPlayerInterior(playerid); GetPlayerHealth(playerid,hp[playerid]); GetPlayerArmour(playerid,armour[playerid]); SetPlayerHealth(playerid,100000); SetPlayerArmour(playerid,0); SetPlayerInterior(playerid,3); SetPlayerPos(playerid,-2668.868408,1410.360107,906.460937); TogglePlayerControllable(playerid,0); GameTextForPlayer(playerid,"~r~ AFK ] MODE",3000,3); tAFK[playerid] = Create3DTextLabel("AFK-MODE", 0xFF0000FF, 0.0, 0.0, 2.0, 40, 0, 0); Attach3DTextLabelToPlayer(tAFK[playerid],playerid, 0.0, 0.0, 0.4); PlayerPlaySound(playerid, 1056, 0, 0, 0); ApplyAnimation(playerid,"DANCING","dance_loop", 4.1,1,1,1,1,1); format(str, sizeof(str), "%s is now Away From Keyboard {FF0000}(AFK)", name); SendClientMessageToAll(green,str); AFK[playerid]=1; SetTimerEx("Kicktimer", TIMEFORMAT(AFK_HOUR, AFK_MINUTES, AFK_SECONDS),false,"d",playerid); AFKcount++; if(AFK[playerid] == 1) { return SendClientMessage(playerid, red, "You are already in AFK. Use /back"); } format(str, sizeof(str), "[Player-Act]: %s has used /afk",GetPName(playerid)); SendAdminMessage(green2,str); return 1; }
if(IsPlayerConnected(playerid)) { print("1"); }
Mind showing this 'TIMEFORMAT(AFK_HOUR, AFK_MINUTES, AFK_SECONDS)'?
|
#define TIMEFORMAT(%0,%1,%2) (((%0)*3600+(%1)*60+(%2))*1000) #define AFK_MINUTES 60 #define AFK_SECONDS 60 #define AFK_HOUR 0
#define TIMEFORMAT(%1,%2) (((%1)*60+(%2))*1000)
#define AFK_MINUTES 60
#define AFK_SECONDS 60
TeamPRO (IP:49) has been kicked from the server(Reason:Exceeded 1 HOUR in AFK)
SetTimerEx("Kicktimer",3600000,false,"d",playerid);
This code can help you.
Just pause for an hour and test it? or use some basic timers to increase the player's paused time and kick them if an hour is passed. EDIT: Didn't see the above post.. |