/mute and /umute cmd plz using sscanf+zcmd
#8

pawn Код:
new muted[MAX_PLAYERS]; // on top of your gm
pawn Код:
CMD:mute(playerid,params[])
{
    new id,str[128];
    if(pInfo[playerid][Adminlevel] >= 1)
    {
        if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"Usage: /mute [id]");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        format(str,sizeof(str),"Admin %s[%i] has Muted %s[%i]",GetPlayersName(playerid),playerid,GetPlayersName(id),id);
        SendClientMessageToAll(COLOR_LIGHTBLUE,str);
        muted[id] = 1;
    }
    else return SendClientMessage(playerid,COLOR_RED1,"You may not use this command");
    return 1;
}
CMD:unmute(playerid,params[])
{
    new id,str[128];
    if(pInfo[playerid][Adminlevel] >= 1)
    {
        if(sscanf(params,"u",id)) return SendClientMessage(playerid,-1,"Usage: /unmute [id]");
        if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000AA, "Player not found");
        format(str,sizeof(str),"Admin %s[%i] has unmuted %s[%i]",GetPlayersName(playerid),playerid,GetPlayersName(id),id);
        SendClientMessageToAll(COLOR_LIGHTBLUE,str);
        muted[id] = 0;
    }
    else return SendClientMessage(playerid,COLOR_RED1,"You may not use this command");
    return 1;
}// add the commands anywhere.
pawn Код:
if(muted[playerid] == 1)
    {
        SendClientMessage(playerid,COLOR_RED1,"You have been muted you can't talk");
        return 0;
    }
// add this at OnPlayerText
stock GetPlayersName(playerid)
{
    new pName[32];
    GetPlayerName(playerid,pName,32);
    return pName;
}// add this anywhere.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)