Server not displaying SendClientMessage -
DetoNater - 06.04.2013
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....
Re: Server not displaying SendClientMessage -
Pottus - 06.04.2013
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); }
Re: Server not displaying SendClientMessage -
DetoNater - 06.04.2013
so what to do next?? set a timer?? Btw is that SA-MP bug??
Re: Server not displaying SendClientMessage -
Pottus - 06.04.2013
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.
Re: Server not displaying SendClientMessage -
DetoNater - 06.04.2013
no bro it's still ain't working, I adjusted the delay time even, but not working >.<
AW: Server not displaying SendClientMessage -
[AK]Nazgul - 06.04.2013
But it's exactly what you gotta do, as he said you have to delay every single Kick(); by setting a TimerEx
Re: Server not displaying SendClientMessage -
DetoNater - 06.04.2013
I edited the script and added TimerEx with every kick(), but still it ain't waroking >.>
AW: Server not displaying SendClientMessage -
[AK]Nazgul - 06.04.2013
Post the code where you set the timer and its callback (It's called when the timer is over)
Re: Server not displaying SendClientMessage -
FalconX - 06.04.2013
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
![Smiley](images/smilies/smile.png)
You may use KickEx( playerid ) instead of Kick( playerid ).
Regards FalconX
Re: Server not displaying SendClientMessage -
DetoNater - 07.04.2013
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?