Anti afk abuse
#1

Ok i want to add a code to my /afk command that when the player /afk it checks if they were recently taking damage and if they were recently taking damage and they tried to do /afk it would send them a message saying you would have to wait like 60seconds before using this command. How would i execute this?

pawn Код:
//My afk coding
CMD:afk(playerid,params[])
{
    if( pInfo[playerid][Spawned]    != 1)
    {
        ShowMessage(playerid, red, 9);
        return 1;
    }
    if(InEvent[playerid] == 1)
    {
        ShowMessage(playerid, red, 11);
    }
    if(Afk[playerid] == 1)
    {
        SendClientMessage(playerid,red,"You are already /afk. Use the /back command to return to playing the game." );
    }
    else
    {
        Afk[playerid] = 1;
        GetPlayerHealth(playerid, afkH[playerid]);
        TogglePlayerControllable(playerid,0);
        GetPlayerArmour(playerid, afkA[playerid]);
        SetPlayerHealth(playerid,300000);
        SetPlayerArmour(playerid,100000);
        GetPlayerName(playerid, afkname, sizeof(afkname));
        format(afkstring,sizeof(afkstring),"[AFK]%s",afkname);
        SetPlayerName(playerid, afkstring);
        SendClientMessage(playerid,red,"Your Status is now set to AFK. (You have 5mins or get kick)");
    }
    return 1;
}
Reply


Messages In This Thread
Anti afk abuse - by 1fret - 22.10.2016, 20:44
Re: Anti afk abuse - by ThatFag - 22.10.2016, 20:56
Re: Anti afk abuse - by 1fret - 22.10.2016, 21:06
Re: Anti afk abuse - by ThatFag - 22.10.2016, 21:12
Re: Anti afk abuse - by Threshold - 23.10.2016, 06:14
Re: Anti afk abuse - by 1fret - 23.10.2016, 22:38
Re: Anti afk abuse [SOLVED] - by 1fret - 23.10.2016, 22:49

Forum Jump:


Users browsing this thread: 1 Guest(s)