31.01.2013, 12:56
Hi all
I am making a Mute command, and some other commands, but i was wondering how i could get only optional "reason" parameter? (the "s" in the (sscanf(params"us[128]")))
I've heard that you can use (-1) behind it, but i am in addition using a [128] behind, so what could i do ?
Thanks for reading!
I am making a Mute command, and some other commands, but i was wondering how i could get only optional "reason" parameter? (the "s" in the (sscanf(params"us[128]")))
pawn Код:
CMD:mute(playerid, params[])
{
new
targetid,
reason[128],
string[200],
string2[200];
if (!IsPlayerAdmin(playerid) && AccInfo[playerid][aLevel] < 3)
return SendClientMessage(playerid, orange, " - Only "cgreen"Level 3+"corange" can perform this command - ");
if(sscanf(params,"us[128]", targetid, reason))
return SendClientMessage(playerid, orange," - Usage: "cblue"\"/MUTE [playerid] [Reason]\" "corange" - Will prevent a player from chatting -");
if(targetid == INVALID_PLAYER_ID)
return SendClientMessage(playerid, orange, " - - - - - Player was not found online / Wrong name/id - - - - - -");
if(targetid==playerid)
return SendClientMessage(playerid, red," - Sorry, you can't mute yourself! - ");
if(AccInfo[targetid][aLevel] > 1)
return SendClientMessage(playerid, red, " - It is not possible to mute Administrators -");
if(GetPVarInt(targetid, "muted") == 1)
return SendClientMessage(playerid, blue, " - Selected Player is already muted -");
SetPVarInt(targetid, "muted", 1);
format(string, sizeof(string), " - Administrator "cwhite"%s "corange"Muted You! "cgrey"||"cblue" (Reason: "cwhite"%s"cblue")", PlayerName(playerid), reason);
SendClientMessage(targetid, orange, string);
format(string2,sizeof(string2),"You have muted "cwhite"%s "cblue"Successfully! He will be unmuted automatically", PlayerName(targetid));
SendClientMessage(playerid, blue , string2);
SetTimerEx("UnMute", 1000*UNMUTETIME, false, "i", targetid);
return 1;
}
Thanks for reading!