Help me in Afk system
#1

Hey , I Made /goafk and /back cmd , it will freeze and TP you out of the Death Match area , but i also want that the player when he types /goafk he'll muted , he won't be able to chat with other players , and when he /back he'll be unmuted How to do that?
Reply
#2

Somewhere above in your script:
pawn Код:
new bool:AFK[MAX_PLAYERS];
Then in the command where he goes afk:
pawn Код:
AFK[playerid] = true;
When he goes back:
pawn Код:
AFK[playerid] = false;
and in the OnPlayerText(playerid, text[]):
pawn Код:
if(AFK[playerid]) return SendClientMessage(playerid, 0xFF0000AA, "You are AFK! You cannot talk");
Reply
#3

I'll Try this thanks !
Reply
#4

.........
lol when i did what you said , i sends that message "You are akf , you can't talk" and it also sends the player's message?
Reply
#5

return 0;
Reply
#6

pawn Код:
new bool:afk_mute[ MAX_PLAYERS char ];//global var
//put this is OnPlayerDisConnect
afk_mute{ playerid } = false ;
//

public OnPlayerText(playerid, text[])
{
    if(afk_mute{ playerid } ==  true )
    {
        SendClientMessage(playerid, 0xFF0000AA, "You are AFK! You cannot talk");
        return 0;
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (!strcmp("/afk", cmdtext, true))
    {
        if(afk_mute{ playerid } != true) {
            afk_mute =  true ;
            //send message that they are afk
        }
        else {
            afk_mute{ playerid } = false ;
            //send message that they are not afk
        }
        return 1;
    }
    return 0;
}
EDITED: First way wouldn't work. (still tierd)
Reply
#7

Here.

At the top

pawn Код:
new AFK[MAX_PLAYERS];
Callback OnPlayerText

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(AFK[playerid] == 1)
    {
        SendClientMessage(playerid,  0xFF0000AA, "You cannot chat. You are afk!");
        return 0;
    }
    return 1;
}
Add this to your go afk cmd

pawn Код:
AFK[playerid] = 1;
Add this to your back cmd

pawn Код:
AFK[playerid] = 0;
Reply
#8

Omg that return sendClientMessage always worked fine for me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)