Mute command.
#1

Код HTML:
CMD:mute(playerid,params[])
{
	if(PInfo[playerid][Level] >= 1) {
	new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],id,reason[64],time;
	if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /mute [playerid] [reason]");
    GetPlayerName(playerid,name, sizeof(name));
    GetPlayerName(id,name2, sizeof(name2));
    format(string, sizeof(string), "%s has been silenced by %s %s [Reason: %s]", name2, aLevel(playerid), name,reason);
    SendClientMessageToAll(COLOR_RED,string);
    PInfo[playerid][pMuted] = 1;
    }
        else //if he has not got the permissions
        {
            SendClientMessage(playerid, COLOR_RED, "You are not admin level 2."); //return this message
        }
    return 1;
}
Ok, so that code works /GREAT/, but at my onplayertext it lets my player use the chat even his muted?

Код HTML:
if(PInfo[playerid][pMuted] == 1) // your variable for logged players if(PInfo[playerid][Logged] == 1)
    {
        SendClientMessage(playerid,0x3FA63CFF," You are muted, not able to speak ICly.");
        return 0;
    }
Reply
#2

Please, someone?
Reply
#3

try this


pawn Код:
CMD:mute(playerid,params[])
{
        new id;
    if(PInfo[playerid][Level] >= 1) {
    new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],id,reason[64],time;
    if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /mute [playerid] [reason]");
    GetPlayerName(playerid,name, sizeof(name));
    GetPlayerName(id,name2, sizeof(name2));
    format(string, sizeof(string), "%s has been silenced by %s %s [Reason: %s]", name2, aLevel(playerid), name,reason);
    SendClientMessageToAll(COLOR_RED,string);
    PInfo[id][pMuted] = 1;
    }
        else //if he has not got the permissions
        {
            SendClientMessage(playerid, COLOR_RED, "You are not admin level 2."); //return this message
        }
    return 1;
}
Reply
#4

I put it a onplayertext.
Reply
#5

Look at my post i have edited it
Reply
#6

Yes dude, but the CMD:mute is working fine already, the problem is on OnPlayerText ....
Reply
#7

What i have changed in your mute command is that you mute yourself if you type someones id try the code i gave you and check if it works
Reply
#8

Nope, it shows up the message that im muted but i can type..
Reply
#9

put this under your includes
pawn Код:
new Muted[MAX_PLAYERS];
replace this with your command
pawn Код:
CMD:mute(playerid,params[])
{
    if(PInfo[playerid][Level] >= 1) {
    new name[MAX_PLAYER_NAME],name2[MAX_PLAYER_NAME],string[128],id,reason[64],time;
    if(sscanf(params,"us[64]",id,reason)) return SendClientMessage(playerid,COLOR_RED,"USAGE: /mute [playerid] [reason]");
    GetPlayerName(playerid,name, sizeof(name));
    GetPlayerName(id,name2, sizeof(name2));
    format(string, sizeof(string), "%s has been silenced by %s %s [Reason: %s]", name2, aLevel(playerid), name,reason);
    SendClientMessageToAll(COLOR_RED,string);
    Muted[id] = 1;
    }
        else //if he has not got the permissions
        {
            SendClientMessage(playerid, COLOR_RED, "You are not admin level 2."); //return this message
        }
    return 1;
}
replace this with the onplayertext that you did
pawn Код:
if(Muted[playerid] == 1)
    {
        SendClientMessage(playerid,0x3FA63CFF," You are muted, not able to speak ICly.");
        return 0;
    }
Reply
#10

I'm still able to write... note that i've an proxdetector at my onplayertext....
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)