AFK Help
#1

Ok i made an afk System but I Run a Roleplay server so it Must be RP Now my idea is To turn a timer on my AFK system
So when a player Write down /afk He will have to stand Still No move, And wait 60 Seconds then he might Turn afk ,

So couldy anybody Add that 60 seconds and No move for me? the lines


PHP код:
    if (strcmp(cmd"/aafk"true) == 0)
    {
        if(
IsPlayerConnected(playerid))
        {
            if (
PlayerInfo[playerid][pAdmin] >= 1)
            {
                if(
AFK[playerid] == 0)
                {
                    if(!
IsPlayerInAnyVehicle(playerid))
                    {
                         
GetPlayerPos(playerid,TeleportDest[playerid][0],TeleportDest[playerid][1],TeleportDest[playerid][2]);
                         
SafeSetPlayerPos(playerid0,0,2500);
                    }
                    else
                    {
                        
GetVehiclePos(idcarTeleportDest[playerid][0],TeleportDest[playerid][1],TeleportDest[playerid][2]);
                        
SetVehiclePos(GetPlayerVehicleID(playerid), 0,0,2500);
                    }
                    
afkadmins ++;
                     
AFK[playerid] = 1;
                     
TogglePlayerControllable(playerid0);
                     
TextDrawShowForPlayer(playeridTextdraw5);
                    
TextDrawShowForPlayer(playeridTextdraw50);
                    
TextDrawHideForPlayer(playeridTextdraw44);
                    
TextDrawHideForPlayer(playeridTextdraw45);
                    
TextDrawHideForPlayer(playeridTextdraw55);
                    
TextDrawHideForPlayer(playeridTextdraw49[playerid]);
                    
TextDrawHideForPlayer(playeridTextdraw51[playerid]);
                    if(
PlayerInfo[playerid][pWatch] == 1)
                    {
                        
TextDrawHideForPlayer(playeridTextdraw56);
                        
TextDrawHideForPlayer(playeridTextdraw57);
                        
TextDrawHideForPlayer(playeridTextdraw58);
                    }
                }
                else
                {
                    if(!
IsPlayerInAnyVehicle(playerid)) SafeSetPlayerPos(playeridTeleportDest[playerid][0],TeleportDest[playerid][1],TeleportDest[playerid][2]);
                    else 
SetVehiclePos(idcarTeleportDest[playerid][0],TeleportDest[playerid][1],TeleportDest[playerid][2]);
                     
afkadmins --;
                     
AFK[playerid] = 0;
                     
TogglePlayerControllable(playerid1);
                     
TextDrawHideForPlayer(playeridTextdraw5);
                    
TextDrawHideForPlayer(playeridTextdraw50);
                    
TextDrawShowForPlayer(playeridTextdraw44);
                    
TextDrawShowForPlayer(playeridTextdraw45);
                    
TextDrawShowForPlayer(playeridTextdraw49[playerid]);
                    
TextDrawShowForPlayer(playeridTextdraw51[playerid]);
                    
TextDrawShowForPlayer(playeridTextdraw55);
                    if(
PlayerInfo[playerid][pWatch] == 1)
                    {
                        
TextDrawShowForPlayer(playeridTextdraw56);
                        
TextDrawShowForPlayer(playeridTextdraw57);
                        
TextDrawShowForPlayer(playeridTextdraw58);
                    }
                }
            }
            else
            {
                
SendClientMessage(playeridCOLOR_GRAD1"* Access Denied.");
            }
        }
        return 
1;
    }
    
    if (
strcmp(cmd"/update"true) == 0)
    {
        if(
PlayerInfo[playerid][pAdmin] >= 4)
        {
            
ShowPlayerDialog(playerid,19990,DIALOG_STYLE_LIST,"Select which thing do you want to reload","1\tUser file\n2\tVehicle File\n3\tHouse File\n3\tBizz File\n4\tSBizz File","Select","Cancel");
        }
        else
        {
            
SendClientMessage(playeridCOLOR_GREY,"* You're not authorised to use this command!");
            return 
1;
        }
        return 
1;
    } 
PS. this if for admin now but will be For regular players later
Reply
#2

just make a timer!

you already have TogglePlayerControllable(playerid, 1);
which will freeze/unfreeze the player
Reply
#3

lol that aint what im talking about XD i need timer so he will wait 60 seconds then he turn afk and when he move it get canceled
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)