Lil problem with dcmd - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Lil problem with dcmd (
/showthread.php?tid=243268)
Lil problem with dcmd -
bijoyekuza - 22.03.2011
hey scripters
before I tell you the problem ,please dont tell me to use ZCMD Cuz I hate it and I dont care if my script will be faster in 1 milisecond.
Ok so I got this cmd
Код:
dcmd_ban(playerid, params[])
{
#pragma unused params
small1;
if(PlayerInfo[playerid][pAdminLevel] > 0)
{
new id,reason[256];
if(sscanf(params,"ui",id,reason))
{
if(IsPlayerConnected(id))
{
new name[MAX_PLAYER_NAME],aname[MAX_PLAYER_NAME],string[256],Year,Month,Day;
GetPlayerName(id,aname,sizeof(aname));
GetPlayerName(playerid,name,sizeof(name));
getdate(Year,Month,Day);
format(string,sizeof(string),"[URP] %d/%d/%d : You have banned %s.",Year,Month,Day,aname);
SendClientMessage(playerid,COLOR_RED,string);
format(string,sizeof(string),"[URP] %d/%d/%d : %s has been banned by Admin MR.%s. Reason : %s",Year,Month,Day,aname,name,reason);
SendClientMessageToAll(COLOR_RED,string);
BanLog(string);
Ban(id);
return 1;
}else return notc(playerid);
}else return SendClientMessage(playerid,COLOR_RED,"[URP] : Usage : /ban [PLAYERID][REASON]");
}
return 1;
}
So No errors but , in the game , when I use /ban(just /ban no reason or playerid) it doesnt returns me the SendClientMessage(playerid,COLOR_RED,"[URP] : Usage : /ban [PLAYERID][REASON]");
and its auto bans me .
and at the
format(string,sizeof(string),"[URP] %d/%d/%d : %s has been banned by Admin MR.%s. Reason : %s",Year,Month,Day,aname,name,reason);
for some reason the reason thing doesnt working . I dont see the reason.
Re: Lil problem with dcmd -
Mike Garber - 22.03.2011
Change
pawn Код:
if(sscanf(params,"ui",id,reason))
to
pawn Код:
if(!sscanf(params,"ui",id,reason))
since sscanf returns 0/false IF it matches, unlike any other function.
Re: Lil problem with dcmd -
bijoyekuza - 22.03.2011
I think ur wrong
why ui ? it supouse to be us because s = string in sscanf .
but I did what you told me to do so now when I do /ban 0 test
it returns me sendclient(blabla,balbal,"usage ban playerid")
if I make the reason an integet like /ban 0 13 it works ok.
I made it if(!sscanf(params,"us",id,reason)) and now its working
Re: Lil problem with dcmd -
HyperZ - 22.03.2011
pawn Код:
if(!sscanf(params,"us[65]",id,reason))