Server not displaying SendClientMessage
#1

My Script:
Code:
CMD:ban(playerid, params[])
{
  if(PlayerInfo[playerid][pAdmin] >= 2)
  {
	new targetid, reason[100];
	if(sscanf(params,"ds[100]", targetid, reason)) return SendClientMessage(playerid, C_RED,"USAGE: /ban [playerid][reason]");
	if(!IsPlayerConnected(playerid) && targetid != INVALID_PLAYER_ID)
	{
	  SendClientMessage(playerid, C_RED,"SERVER: Player is not connected!");
	}
	else
	{
	  new bquery[200], IP[16];
	  GetPlayerIp(targetid, IP, 16);
	  format(bquery, sizeof(bquery),"INSERT INTO bandata(admin, player, reason, IP, banned) VALUES('%s', '%s', '%s','%s', 1)", PlayerName(playerid),PlayerName(targetid), reason, IP);
	  mysql_query(bquery);
	  new string[256];
	  format(string, sizeof(string),"%s has been banned by Admin %s [Reason: %s]", PlayerName(targetid), PlayerName(playerid), reason);
	  SendClientMessageToAll(C_RED, string);
	  mysql_free_result();
	  Kick(targetid);
	}
  } else return SendClientMessage(playerid, C_RED,"You are not authorized to use this command!");
  return 1;
}
but see the screenshot....
http://i.imgur.com/uEcWgfw.jpg


//===============================================
Ban check
Code:
stock MySQL_BanCheck(playerid)
{
  new query[200], admin[50], pname[50], IP[16], string1[100];
  GetPlayerIp(playerid, IP, 16);
  format(query, sizeof(query),"SELECT * FROM `bandata` WHERE(`player`='%s' OR `IP`='%s') AND `banned`=1 LIMIT 1", escpname(playerid), IP);
  mysql_query(query);
  mysql_store_result();
  if(mysql_num_rows() != 0)
  {
	 while(mysql_fetch_row(query))
	 {
	   mysql_fetch_field_row(admin, "admin");
	   mysql_fetch_field_row(pname, "player");
	   mysql_fetch_field_row(string1, "reason");
	 }

     new string[50], str[50], str1[100];
     format(string, sizeof(string),"Admin: %s", admin);
     format(str, sizeof(str),"Player: %s", pname);
     format(str1, sizeof(str1),"Reason: %s", string1);
     SendClientMessage(playerid, C_RED,"You are banned from this server!");
     SendClientMessage(playerid, C_RED,"___________________");
     SendClientMessage(playerid, C_RED, str);
     SendClientMessage(playerid, C_RED, string);
     SendClientMessage(playerid, C_RED, str1);
     SendClientMessage(playerid, C_RED,"___________________");
     SendClientMessage(playerid, C_RED, "If you think that this BAN was a mistake, then post a screenshot(using F8) on our website");
     SendClientMessage(playerid, C_RED, "www.kz.com");
     Kick(playerid);
  }
  mysql_free_result();
  return 1;
}
but see the screenshot:
http://i.imgur.com/OmNWmJf.png

but i dont get the thing i define in SendClientMessage
Note: There are no errors in Pawno compile....
Reply
#2

Remember it takes time for those messages to get to the clients I'm thinking you need a delay before kicking the player so they can receive those message I could be wrong but that is what looks like is happening.

Code:
DelayKick(playerid, delay) { SetTimerEx("KickPlayer", delay, false, "i", playerid); }
forward KickPlayer(playerid);
public KickPlayer(playerid) { Kick(playerid); }
Reply
#3

so what to do next?? set a timer?? Btw is that SA-MP bug??
Reply
#4

I gave you the code just put that in and try

replace Kick(playerid); with this

DelayKick(playerid, 1000);

It will kick after a second cheers.
Reply
#5

no bro it's still ain't working, I adjusted the delay time even, but not working >.<
Reply
#6

But it's exactly what you gotta do, as he said you have to delay every single Kick(); by setting a TimerEx
Reply
#7

I edited the script and added TimerEx with every kick(), but still it ain't waroking >.>
Reply
#8

Post the code where you set the timer and its callback (It's called when the timer is over)
Reply
#9

I use this:

pawn Code:
forward KICK_PLAYER( playerid ); // at top

////////////////////////////////////////////////

// anywhere in the script

////////////////////////////////////////////////

KickEx( playerid )
{
    SetTimerEx( "KICK_PLAYER", 1000, false, "d", playerid );
    return 1;
}

public KICK_PLAYER( playerid )
{
    Kick( playerid );
}

////////////////////////////////////////////////
////////////////////////////////////////////////
So, this delays the kick by 1 second and all the previous messages are shown before kick You may use KickEx( playerid ) instead of Kick( playerid ).

Regards FalconX
Reply
#10

thanks bros(falcon, nazy, pottus), its that issue only, now it worked fine... btw i changed, the timer from 1000 to 001

//------------------
I want to make Delay SendClientMessageToAll, btw i how to do it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)