SA-MP Forums Archive
Kick & Ban does not Show Message[HELP] - 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: Kick & Ban does not Show Message[HELP] (/showthread.php?tid=551508)



Kick & Ban does not Show Message[HELP] - Kudoz - 19.12.2014

This code of /ban and /Kick command doesn't show the SendClientMessage.. Why's this? Can anyone help me out?

Код:
 CMD:kick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		new id;
		new str[1000];
		new reason[56];
		new AdminName[MAX_PLAYER_NAME];
		new Target[MAX_PLAYER_NAME];
	    if(sscanf(params, "us", id, reason)) return SendClientMessage(playerid, grey, "Usage:/kick (playerid/partofname) (reason)");
	    else
	    {
			GetPlayerName(id, Target, sizeof(Target));
			GetPlayerName(playerid, AdminName, sizeof(AdminName));
	    	format(str, sizeof(str), ".: [{B4B5B7}Admin{FF6347}] ( {B4B5B7}%s {FF6347}) {B4B5B7}has kicked {FF6347}( {B4B5B7}%s {FF6347}){B4B5B7}, {FF6347}Reason; {B4B5B7}%s {FF6347}:.", AdminName, Target, reason);
			SendClientMessageToAll(lightred, str);
			
			SetTimerEx("DelayedKick", 500, false, "d", id);
		}
	}
	else return SendClientMessage(playerid, lightred, "[{B4B5B7}System{FF6347}]: {B4B5B7}You aren't authorized to use this command.");
	return 1;
}
Код:
  CMD:ban(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 3)
	{
	    new id;
	    new reason[128];
	    if(sscanf(params, "us[128]", id, reason)) return SendClientMessage(playerid, grey, "Usage:/ban (playerid/partofname) (reason)");
        if(PlayerInfo[playerid][pAdmin] > PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid, lightred,"[{B4B5B7}System{FF6347}]: {B4B5B7}You cant ban an Administrator!");
        if(id == playerid) return SendClientMessage(playerid, lightred,"[{B4B5B7}System{FF6347}]: {B4B5B7}You cant ban yourself!");
		if(id == INVALID_PLAYER_ID) SendClientMessage(playerid, lightred, "[{B4B5B7}System{FF6347}]: {B4B5B7}Player not found!");
		else
		{
		    new year;
			new month;
			new day;
			new	hour;
			new minuite;
			new second;
			new str[1000];
			new AdminName[MAX_PLAYER_NAME];
			new Target[MAX_PLAYER_NAME];

			getdate(year, month, day);
			gettime(hour,minuite,second);
			GetPlayerName(playerid, AdminName, sizeof(AdminName));
			GetPlayerName(id, Target, sizeof(Target));

		    format(str, sizeof(str), "[{B4B5B7}Admin{FF6347}]{B4B5B7}( %s ) Has [ BANNED ] {FF6347}[{B4B5B7}Player{FF6347}]{B4B5B7}( %s ), {FF6347}Reason: {B4B5B7}%s :.", AdminName, Target, reason);
			SendClientMessageToAll(lightred, str);

			#define DIALOG_BAN  9706
			format(str, sizeof(str), "{FF6347}Admin Name: {B4B5B7}%s .\n{FF6347}Date: {B4B5B7}%d{FF6347}/{B4B5B7}%d{FF6347}/{B4B5B7}%d .\n{FF6347}Time: {B4B5B7}%d{FF6347}:{B4B5B7}%d .\n{FF6347}Reason: {B4B5B7}%s .", AdminName, day, month, year, hour, minuite, reason);
			ShowPlayerDialog(id, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "Ban Notice", str, "OK", "");

			SetTimerEx("DelayedBan", 1000, false, "d", id);
			PlayerInfo[id][pBanned] = 1;
		}
	}
	else return SendClientMessage(playerid, lightred, "[{B4B5B7}System{FF6347}]: {B4B5B7}You aren't authorized to use this command.");
	return 1;
}



Re: Kick & Ban does not Show Message[HELP] - Schneider - 19.12.2014

The string you are formatting already has 144 characters, and that even excluded the names and reason. Any client-message with more than 144 characters will not be send.
Just get rid of all these unnecessary colors and you'll be good to go.


Re: Kick & Ban does not Show Message[HELP] - Kudoz - 19.12.2014

oh thanks! Is there ANY way I can expand this string?


Re: Kick & Ban does not Show Message[HELP] - Schneider - 19.12.2014

Not in 1 clientmessage. You'll have so seperate them into multiple clientmessages.

Edit: By the way, reserving 1000 bytes (new str[1000] is just a waste of memory and server-performance.


Re: Kick & Ban does not Show Message[HELP] - NGGMars - 19.12.2014

This is ussual msg, when kick or ban the reason msgs are not getting to client..

You need to set a timer 2 or 3 sec to ban or kick. It fixed


Re: Kick & Ban does not Show Message[HELP] - Schneider - 19.12.2014

Quote:
Originally Posted by FuriousRoleplay
Посмотреть сообщение
This is ussual msg, when kick or ban the reason msgs are not getting to client..
You need to set a timer 2 or 3 sec to ban or kick. It fixed
If you actually would have read his code, you would have seen he's already a delay ban/kick timer...


Re: Kick & Ban does not Show Message[HELP] - Kudoz - 19.12.2014

and 2-3 sec are way too much lol, you only need a few millisec. That's enough.
But I figured it out cleaned my msg from some colors, and now it's fine. Thanks!