PDA

View Full Version : problem command /mute


kloning1
21/03/2014, 04:10 PM
help ,,
i have problem with command /mute
can you help me? :( please

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
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.

Konstantinos
21/03/2014, 04:14 PM
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:

if(pInfo[playerid][pVIP] == 1 || pInfo[playerid][pAdmin] >= 1)

which checks if the player is VIP or admin with level 1 or higher.

UnknownOwner
21/03/2014, 04:18 PM
Use
if(pInfo[playerid][pVIP] == 1 || pInfo[playerid][pAdmin] >= 1)

kloning1
21/03/2014, 04:21 PM
thx sir :)

i have problem again sir ,,
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.

Konstantinos
21/03/2014, 04:24 PM
You need to declare szString.

Add:

new szString[128];

under the line:

GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName));
so it will be defined before the line is used (in format).

Hanuman
21/03/2014, 04:28 PM
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;
}