Why isn't this get triggered?
#1

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.
Reply
#2

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
Reply
#3

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)