SA-MP Forums Archive
Help me in Afk system - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help me in Afk system (/showthread.php?tid=239282)



Help me in Afk system - Soumi - 13.03.2011

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?


Re: Help me in Afk system - Kwarde - 13.03.2011

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");



Re : Help me in Afk system - Soumi - 13.03.2011

I'll Try this thanks !


Re : Help me in Afk system - Soumi - 13.03.2011

.........
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?


Re: Help me in Afk system - Markx - 13.03.2011

return 0;


Re: Help me in Afk system - iggy1 - 13.03.2011

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)


Re: Help me in Afk system - xir - 13.03.2011

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;



Re: Help me in Afk system - Kwarde - 13.03.2011

Omg that return sendClientMessage always worked fine for me