/moviestyle and /mute /unmute Command
#7

Not the best code I've seen for mute and unmute Riddy.
pawn Код:
new Muted[MAX_PLAYERS];
CMD:mute(playerid,params[])
{
    new id, reason[60];
    if(pInfo[playerid][AdminVariable] < 2) return SendClientMessage(playerid, 0xFF0000FF, "You Must Be An Administrator To Use This Command!");
    //Obviously replace pInfo[playerid][AdminVariable] with your own admin variable, does not have to be 2, change at will.
    if(sscanf(params, "us(No Reason)", id, reason)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX ERROR: {00FF00}/MUTE {FFFF00}<PlayerID> <Optional: Reason>");
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "This Player Is Not Connected.");
    if(Muted[id] == 1) return SendClientMessage(playerid, 0xFF0000FF, "This Player Is Already Muted. Use {00FF00}/UNMUTE{FF0000}.");
    Muted[id] = 1;
    new string[150];
    new TargetName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME];
    GetPlayerName(id, TargetName, MAX_PLAYER_NAME);
    GetPlayerName(playerid, AdminName, MAX_PLAYER_NAME);
    format(string,sizeof(string),"You Have Been Muted By Administrator %s | Reason: %s", AdminName, reason);
    SendClientMessage(id, 0xFF0000FF, string);
    format(string,sizeof(string),"You Have Muted %s | Reason: %s", TargetName, reason);
    SendClientMessage(playerid, 0xFFFF00FF, string);
    format(string,sizeof(string),"%s Has Been Muted By Administrator %s | Reason: %s", TargetName, AdminName, reason);
    SendClientMessageToAll(0xFF0000FF, string);
    return 1;
}

CMD:unmute(playerid,params[])
{
    new id;
    if(pInfo[playerid][AdminVariable] < 2) return SendClientMessage(playerid, 0xFF0000FF, "You Must Be An Administrator To Use This Command!");
    //Same rules apply here as above.
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, 0xFF0000FF, "SYNTAX ERROR: {00FF00}/UNMUTE {FFFF00}<PlayerID>");
    if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "This Player Is Not Connected.");
    if(Muted[id] == 0) return SendClientMessage(playerid, 0xFF0000FF, "This Player Is Already Unmuted. Use {00FF00}/MUTE{FF0000}.");
    Muted[id] = 0;
    new string[150];
    new TargetName[MAX_PLAYER_NAME], AdminName[MAX_PLAYER_NAME];
    GetPlayerName(id, TargetName, MAX_PLAYER_NAME);
    GetPlayerName(playerid, AdminName, MAX_PLAYER_NAME);
    format(string,sizeof(string),"You Have Been Unmuted By Administrator %s.",AdminName);
    SendClientMessage(id, 0xFFFF00FF, string);
    format(string,sizeof(string),"You Have Unmuted %s.",TargetName);
    SendClientMessage(playerid, 0xFFFF00FF, string);
    format(string,sizeof(string),"%s Has Been Unmuted By %s.",TargetName,AdminName);
    SendClientMessageToAll(0xFFFF00FF, string);
    return 1;
}

public OnPlayerText(playerid, text[])
{
    if(Muted[playerid] == 1) return SendClientMessage(playerid, 0xFF0000FF, "You Have Been Muted And Cannot Speak!");
    //Code continues...
    return 0;
}
Reply


Messages In This Thread
/moviestyle and /mute /unmute Command - by Blackazur - 08.09.2012, 13:29
Re: /moviestyle and /mute /unmute Command - by vIBIENNYx - 08.09.2012, 14:01
AW: /moviestyle and /mute /unmute Command - by Blackazur - 08.09.2012, 14:10
Re: /moviestyle and /mute /unmute Command - by Guest3598475934857938411 - 08.09.2012, 14:47
AW: /moviestyle and /mute /unmute Command - by Blackazur - 08.09.2012, 14:54
Re: /moviestyle and /mute /unmute Command - by Riddy - 08.09.2012, 15:22
Re: /moviestyle and /mute /unmute Command - by clarencecuzz - 08.09.2012, 15:36

Forum Jump:


Users browsing this thread: 2 Guest(s)