SA-MP Forums Archive
Why isn't this get triggered? - 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)
+--- Thread: Why isn't this get triggered? (/showthread.php?tid=626306)



Why isn't this get triggered? - coool - 13.01.2017

Hi Brothers. I have a problem when I use my cmd /ban it show nothing just bans me..
My cmd..
PHP код:
CMD:ban(playeridparams[])
{
    new 
bstring[200], btargidbreason[45];
    if(
PlayerInfo[playerid][pAdmin] == 0) return SCM(playerid0xFF0000FF"You must be an admin to use this command");//I have to change
    
if(sscanf(params"us[45]"btargidbreason)) return SCM(playerid0xFF0000FF"USAGE: /ban  [id] [reason]");
    if(!
IsPlayerConnected(btargid)) return SCM(playerid0xFF0000FF"Your specified player is not connected");
    if(
btargid == INVALID_PLAYER_ID) return SCM(playerid0xFF0000FF"You have specified an invaild player id");
    
format(bstringsizeof(bstring), "Admin %s (%i) has banned %s (%i) for %s"getName(playerid), playeridgetName(btargid), btargidbreason);
    
SendClientMessageToAll(COLOR_YELLOWbstring);
    new 
bstr[51];
    
SCM(playerid0x00FF00FF"Cheater banned!");
    
SCM(btargid0x0000FFFF"You are BANNED!");
    
format(bstrsizeof(bstr), "~r~BANNED FOR %s"breason);
    
GameTextForPlayer(btargidbstr20001);
    
Ban(btargid);
    new 
query[512], PlayerIP[16];
    
GetPlayerIp(btargidPlayerIPsizeof(PlayerIP));
    
mysql_format(mysqlquerysizeof(query), "INSERT INTO `bans` (Admin = '%e', Reason = '%e', Ip = '%e') WHERE Name = '%e'"getName(playerid), breasonPlayerIPgetName(btargid));
    
mysql_tquery(mysqlquery" "" ");
    return 
1;

Even the first SendClientMessageToAll dosen't gets triggered. But the ban in last gets triggered.


Re: Why isn't this get triggered? - Lordzy - 13.01.2017

You must delay the "Ban" function.
Quote:
Originally Posted by SAMPWiki
As of SA-MP 0.3x, any action taken directly before Ban() (such as sending a message with SendClientMessage) will not reach the player. A timer must be used to delay the ban.
https://sampwiki.blast.hk/wiki/Ban
https://sampforum.blast.hk/showthread.php?tid=540505


Re: Why isn't this get triggered? - coool - 13.01.2017

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
Thank you Very Very much. You made my day. This was increasing my hyperness


Re: Why isn't this get triggered? - ISmokezU - 13.01.2017

I think you should kick the player instead of using the Ban from samp. seems like you're making your own ban system