CMD:jail(playerid,params[])
{
new TargetID,mins,hours,reason[100], string[256];
if(pInfo[playerid][Adminlevel] < 5) return SCM(playerid, COLOR_ERROR,""ERROR_MESSAGE"");
if(!pInfo[playerid][LoggedInAsAdmin]) return SCM(playerid,COLOR_ERROR,""ERROR_MESSAGE"");
if(caged[TargetID] == 1) return SCM(playerid,COLOR_ERROR,CAGED_ERROR);
if(sscanf(params, "uI(1)I(30)S()[50]", TargetID,hours,mins,reason)) return SCM(playerid, COLOR_ERROR, "Usage: /jail (Name/ID) (Hours) (Mins) (Reason)");
if(TargetID == INVALID_PLAYER_ID || !IsPlayerConnected(TargetID )) return SCM(playerid, COLOR_ERROR, ERROR_INVALID_PLAYER);
if(pInfo[TargetID][Adminlevel] && TargetID != playerid) return SCM(playerid,COLOR_ERROR,"You Can't Use this Command On An Admin");
if(pInfo[TargetID][Jailed] == 0)
{
pInfo[TargetID][pJailHour] =hours;
pInfo[TargetID][pJailMinute] =mins;
JailPlayer(TargetID);
SetPlayerInterior(TargetID,10);
pInfo[TargetID][Jailed] = 1;
if(!strlen(reason)) format(string,sizeof(string),">> JAIL: "ORANGE"%s (%d)"ADMIN" (Admin Jail) No Reason Specified",pInfo[TargetID][playername],TargetID);
else format(string,sizeof(string),">> JAIL: "ORANGE"%s (%d)"ADMIN" (Admin Jail) (reason: %s)",pInfo[TargetID][playername],TargetID,reason);
SCMA(COLOR_ADMIN,string);
}
else
{
format(string,sizeof(string),"You have released %s (%d) form jail",pInfo[TargetID][playername],TargetID);
SCM(playerid,COLOR_SKYBLUE,string);
SCM(TargetID,COLOR_SKYBLUE,"You have been released from jail by an admin.");
JailRelease(TargetID);
}
return 1;
}
if(sscanf(params, "uI(1)I(30)S()[50]", TargetID,hours,mins,reason))
I wouldn't even suggest using the "u" specifier. I posted a help thread the other day about it because it doesn't match names properly.
I would suggest writing your own specifier with "k" instead. |
The "u" specifier works perfectly fine for me last time I checked.
![]() |
stock Name(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
return name;
}
stock CkeckUserNum(const text[])
{
new m, i, c;
foreach(Player : i)
{
m = strfind(Name(i), text, true);
if(m != -1) c++;
}
if(m > 1)return true;//more than 1 user
return false;
}
//in the command like this
if(CheckUserNum(PART_OF_NAME_TO_SEARCH))return SendClientMessage(playerid, -1, "{ff0000}More than 1 user found please be more specific");
like this use these stocks--
pawn Код:
|
The only way I can think of doing that is to call "sscanf" twice - once with two "i" specifiers, and then a second time without if the first one fails.
|
An example would be how you already call it, but do it twice not once.
|
after that how can we make if the player types uchiha and the name is sasuke_uchiha it will work with making MATCH_NAME_PARTIAL but how to do that if there are 3 online player 1 me and other two Sasuke_uchiha and Itachi_Uchiha if i type uchiha it should say "Uchiha is found in multiple name please be more specific"
|