problem command /mute
#1

help ,,
i have problem with command /mute
can you help me? please

pawn Код:
CMD:mute(playerid,params[]) {
    if(pInfo[playerid][pVIP] == 1) || pInfo[playerid][pAdmin] < 1) // << I guess, this is the error
    {
        new id,time,reason[256],PlayerName[MAX_PLAYER_NAME], GPlayerName[MAX_PLAYER_NAME];
        if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /mute <playerid> <time> <reason>");
        if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
        if(PlayerInfo[id][AdminLevel] > PlayerInfo[playerid][AdminLevel])return SendClientMessage(playerid,COLOR_RED,"ERROR: He/She is a greater level than your level.");
        if(Muted[id] == 1)return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is already muted.");
        GetPlayerName(id, PlayerName, sizeof(PlayerName));
        GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
        format(szString, sizeof(szString), "-X Admin-: %s (ID:%d) has been muted for %d minutes; Reason: %s", PlayerName, id, time, reason);
        SendClientMessageToAll(COLOR_RED, szString);
        format(szString, sizeof(szString), "Admin %s, Command Used 'MUTE' Taregt: %s (ID:%d)", GPlayerName, PlayerName, id);
        SendClientMessageToAdmins(szString);


        Muted[id] = 1;
        MuteTimer[id] = SetTimerEx("Unmute",time*60000, false, "i", id);
    }
    else {
        return 0;
    }
    return 1;
}
get errors
pawn Код:
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(277) : error 029: invalid expression, assumed zero
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(277) : warning 215: expression has no effect
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(277) : error 001: expected token: ";", but found ")"
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(277) : error 029: invalid expression, assumed zero
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(277) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

You use ")" before OR (||) which is invalid. By the way that line does check if the player is VIP or admin level lesser than 1 (0 or negative). So change to:
pawn Код:
if(pInfo[playerid][pVIP] == 1 || pInfo[playerid][pAdmin] >= 1)
which checks if the player is VIP or admin with level 1 or higher.
Reply
#3

Use
Код:
if(pInfo[playerid][pVIP] == 1 || pInfo[playerid][pAdmin] >= 1)
Reply
#4

thx sir

i have problem again sir ,,
pawn Код:
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(287) : error 017: undefined symbol "szString"
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(287) : error 017: undefined symbol "szString"
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(287) : error 029: invalid expression, assumed zero
C:\Users\Mas O\Documents\SanDrifter\filterscripts\carcolor.pwn(287) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#5

You need to declare szString.

Add:
pawn Код:
new szString[128];
under the line:
pawn Код:
GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
so it will be defined before the line is used (in format).
Reply
#6

Replace ur cmd withis cmd
Код:
CMD:mute(playerid,params[]) {
    if(pInfo[playerid][pVIP] == 1 || pInfo[playerid][pAdmin] >= 1)
    {
        new id,time,reason[256],PlayerName[MAX_PLAYER_NAME], GPlayerName[MAX_PLAYER_NAME];
        new szString[128];
        if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /mute <playerid> <time> <reason>");
        if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");
        if(PlayerInfo[id][AdminLevel] > PlayerInfo[playerid][AdminLevel])return SendClientMessage(playerid,COLOR_RED,"ERROR: He/She is a greater level than your level.");
        if(Muted[id] == 1)return SendClientMessage(playerid,COLOR_RED,"ERROR: Player is already muted.");
        GetPlayerName(id, PlayerName, sizeof(PlayerName));
        GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
        format(szString, sizeof(szString), "-X Admin-: %s (ID:%d) has been muted for %d minutes; Reason: %s", PlayerName, id, time, reason);
        SendClientMessageToAll(COLOR_RED, szString);
        format(szString, sizeof(szString), "Admin %s, Command Used 'MUTE' Taregt: %s (ID:%d)", GPlayerName, PlayerName, id);
        SendClientMessageToAdmins(szString);


        Muted[id] = 1;
        MuteTimer[id] = SetTimerEx("Unmute",time*60000, false, "i", id);
    }
    else {
        return 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)