20.02.2010, 09:31
Hey there!
I'm having some problems with detecting multiple parameters in a command. It should send a message saying how to use the command, but if I use strlen, it never detects that the string is empty and always sends me the message, even if I type something more. If I use if(!params[0]), it also never detects it's empty, but still proceeds as if the string wasn't empty.
Just an example in my /mute command, though it happens in every command.
I'm having some problems with detecting multiple parameters in a command. It should send a message saying how to use the command, but if I use strlen, it never detects that the string is empty and always sends me the message, even if I type something more. If I use if(!params[0]), it also never detects it's empty, but still proceeds as if the string wasn't empty.
Just an example in my /mute command, though it happens in every command.
pawn Код:
command(unmute, playerid, params[])
{
if(AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
{
new
giveplayerid;
if(!IsNumeric(params)) giveplayerid = ReturnPlayerID(params);
else giveplayerid = strval(params);
if(!params[0]) return SendClientMessage(playerid, RED, "Usage: /unmute [ID]");
if(IsPlayerConnected(giveplayerid))
{
format(stringy, sizeof(stringy), "You have been unmuted by administrator %s.", PlayerName(playerid));
SendClientMessage(giveplayerid, RED, stringy);
AccountInfo[giveplayerid][Muted] = 0;
SaveLog("MuteLog", stringy);
}
else return SendClientMessage(playerid, RED, "Error: That player is not connected.");
}
else return SendClientMessage(playerid, RED, "Error: Your administrator level is not high enough for this command.");
return 1;
}