13.03.2015, 19:18
Hello i've this command to set wanted level everything is fine, but i want if i didnt type the reason it will set the player's wanted without reason but that didnt work its keep asking me to put the reason what i am doing wrong?!
PHP код:
CMD:wanted(playerid,params[])
{
new TargetID, name[24], tname[24], str[100], reason[100], wl;
if(pdata[playerid][Adminstator] < 3) return SendClientMessage(playerid,Red,"Command not found! Type /cmds");
if(sscanf(params, "uds[100]",TargetID,wl,reason)) return SendClientMessage(playerid,Red,"Set player's wanted level: /wanted <id> <level> <reason>");
if(isnull(reason))
{
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),"%s %s has set your wanted level to %d: No reason",AdminLevel(playerid),name,wl);
SendClientMessage(TargetID,Red,str);
SetPlayerWantedLevel(TargetID,wl);
}
else
{
GetPlayerName(playerid,name,sizeof(name));
format(str,sizeof(str),"%s %s has set your wanted level to %d: %s",AdminLevel(playerid),name,wl,reason);
SendClientMessage(TargetID,Red,str);
SetPlayerWantedLevel(TargetID,wl);
}
return 1;
}