Jump to content
  • 0

modificare comanda


botz00r

Question

Am o comanda pentru /mute doar ca nu e compatibila cu gm-ul meu. e zcmd cum as putea faceo pentru strcmp?

//at top of script
#include <zcmd>
forward UnmutePlayer(playerid);
new Muted[MAX_PLAYERS];


zcmd(mute, playerid, params[]) //with time in minutes
{
    if(IsPlayerAdmin(playerid))
    {
        new mplayer, time, reason[96];
        if(!sscanf(params, "uis", mplayer, time, reason))
        {
            Muted[mplayer] = 1;
            SetTimerEx("UnmutePlayer", false, 60000*time, "i", playerid);
            new string[128], name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "You were muted by %s for %d minutes. Reason: %s", name, time, reason);
            SendClientMessage(mplayer, 0xFF3300FF, string);
            return 1;
        }
        else return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /mute [id/partname] [time in minutes] [reason]);
    }
    else return SendClientMessage(playerid, 0xFF3300FF, "ERROR: You are not an admin and may not use this command!");
}

public UnmutePlayer(playerid)
{
    SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: You have been unmuted.");
    Muted[playerid] = 0;
}

public OnPlayerText(playerid, text[])
{
    if(Muted[playerid]) SendClientMessage(playerid, 0xFF3300FF, "SERVER: You are muted and may not speak!"), return 0;
    else return 1;
}

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

if(strcmp(cmd, "/mute", true) == 0)
{
    if(IsPlayerAdmin(playerid))
    {
        new mplayer, time, reason[96];
        if(!sscanf(params, "uis", mplayer, time, reason))
        {
            Muted[mplayer] = 1;
            SetTimerEx("UnmutePlayer", false, 60000*time, "i", playerid);
            new string[128], name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "You were muted by %s for %d minutes. Reason: %s", name, time, reason);
            SendClientMessage(mplayer, 0xFF3300FF, string);
            return 1;
        }
        else return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /mute [id/partname] [time in minutes] [reason]);
    }
    else return SendClientMessage(playerid, 0xFF3300FF, "ERROR: You are not an admin and may not use this command!");
}

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.