/mute command
#1

PHP код:
dcmd_mute(playerid, params[])
{
    new 
pID, time, reason[128];
    if(
adminlevel==0) return SendClientMessage(playerid, COLOR_WHITE, "Server: Unrecognized command, type /commands to see the commands available for you.");
    if(
adminlevel<2) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This command is unavailable for your admin rank.");
    if(
sscanf(params, "uds", pID, time, reason)) return SendClientMessage(playerid, COLOR_ADMINBLUE, "Correct usage: /mute [name/id] [seconds] [reason]");
    if(!
IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: This player is not connected.");
    if(
playerid==pID) return SendClientMessage(playerid, COLOR_ADMINBLUE, "ERROR: You cannot mute yourself.");
    new 
pIDadminlevel;
    
INI_ParseFile(UserPath(pID), "LoadUser_%s", .bExtra = true, .extra = pID);
    
pIDadminlevel= PlayerInfo[pID][pAdmin];
    if(
pIDadminlevel>0)
    {
        if(
adminlevel==10)
        {
            
muted[pID] = 1;
            new 
amalmuteclient[128], amalmuteserver[128];
            
format(amalmuteclient, sizeof(amalmuteclient), "You have been muted by the Senior Admin AmalM for %d seconds (Reason: %s).", time, reason);
            
SendClientMessage(pID, COLOR_BRIGHTRED, amalmuteclient);
            new 
pName[128];
            
GetPlayerName(pID, pName, sizeof(pName));
            
format(amalmuteserver, sizeof(amalmuteserver), "Admin-mute: %s(%d) has been muted by the Senior Admin AmalM for %d seconds (Reason: %s).", pName, pID, time, reason);
            
SendClientMessageToAll(COLOR_BRIGHTRED, amalmuteserver);
            
SetTimerEx("amalmute", time*1000, false, "is", pID, pName);
        }
        else
        {
            
muted[pID] = 1;
            new 
muteclient[128], muteserver[128];
            
format(muteclient, sizeof(muteclient), "You have been muted by an admin for %d seconds (Reason: %s).", time, reason);
            
SendClientMessage(pID, COLOR_BRIGHTRED, muteclient);
            new 
pName[128];
            
GetPlayerName(pID, pName, sizeof(pName));
            
format(muteserver, sizeof(muteserver), "Admin-mute: %s(%d) has been muted for %d seconds (Reason: %s).", pName, pID, time, reason);
               
SendClientMessageToAll(COLOR_BRIGHTRED, muteserver);
            
SetTimerEx("mute", time*1000, false, "i", pID, pName);
        }
    }
    return 
1;
}
forward amalmute(pID, pName);
public 
amalmute(pID, pName)
{
    
muted[pID] = 0;
    
SendClientMessage(pID, COLOR_BRIGHTRED, "You have been auto-unmuted.");
    new 
unmuted[128];
    
format(unmuted, sizeof(unmuted), "Auto-unmute: %s(%d) has been auto-unmuted.");
    
SendClientMessageToAll(COLOR_BRIGHTRED, unmuted);
    return 
1;
}
forward mute(pID, pName);
public 
mute(pID, pName)
{
    
muted[pID] = 0;
    
SendClientMessage(pID, COLOR_BRIGHTRED, "You have been auto-unmuted.");
    new 
unmuted[128];
    
format(unmuted, sizeof(unmuted), "Auto-unmute: %s(%d) has been auto-unmuted.");
    
SendClientMessageToAll(COLOR_BRIGHTRED, unmuted);
    return 
1;
} 
What's the problem in this script?

I gets the error
Quote:

E:\My Server\gamemodes\SARCR.pwn(831) : error 028: invalid subscript (not an array or too many subscripts): "muted"
E:\My Server\gamemodes\SARCR.pwn(831) : warning 215: expression has no effect
E:\My Server\gamemodes\SARCR.pwn(831) : error 001: expected token: ";", but found "]"
E:\My Server\gamemodes\SARCR.pwn(831) : error 029: invalid expression, assumed zero

Someone please help me.
Reply


Messages In This Thread
/mute command - by ATGOggy - 09.11.2014, 07:54
Re: /mute command - by dominik523 - 09.11.2014, 08:18
Re: /mute command - by ATGOggy - 09.11.2014, 08:21
Re: /mute command - by dominik523 - 09.11.2014, 08:23
Re: /mute command - by ATGOggy - 09.11.2014, 08:28
Re: /mute command - by Quickie - 09.11.2014, 08:34
Re: /mute command - by ATGOggy - 09.11.2014, 08:38
Re: /mute command - by Quickie - 09.11.2014, 08:42
Re: /mute command - by ATGOggy - 09.11.2014, 08:44
Re: /mute command - by ATGOggy - 12.11.2014, 13:08

Forum Jump:


Users browsing this thread: 1 Guest(s)