SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 13/03/2020, 06:14 PM   #1
RuggieroY
Little Clucker
 
Join Date: Dec 2019
Posts: 2
Reputation: 0
Default Help with kick command

Hi everyone, I have a problem with the kick command. Basically, when I kick a player in game, this player shows only "Server closed the connection", but not the reason of the kick (admin kick the player for reason ecc). Why? Thank you for the help.

NB: Sorry for my bad english

Code:
CMD:kick(playerid,params[])
	{
	new IDPkick;
	new Reason[256];
	new str[256];
		if(Player[playerid][level]>=1)
		{
			if(sscanf(params, "is[100]", IDPkick, Reason)== 0)
			{
				if(IsPlayerConnected(IDPkick))
				{
					format(str,256,"[Info:] {FFFFFF}Admin %s has kicked %s from the server. Reason:{FF0000} %s", gName(playerid), gName(IDPkick), Reason);
					SendClientMessageToAll(COLOR_GREEN,str);
    			       }
				else return SendClientMessage(playerid, COLOR_RED,"[Error:] {FFFFFF}This player is offline");
			}
			else return SendClientMessage(playerid, COLOR_GREEN,"[Use:] {FFFFFF}/KICK <ID> [REASON]");
		}
		else return SendClientMessage(playerid, COLOR_RED,"[Error:] {FFFFFF}You are not an admin!");
	Kick(IDPkick);
	return 1;
	}
RuggieroY is offline   Reply With Quote
Old 13/03/2020, 06:19 PM   #2
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 621
Reputation: 57
Default Re: Help with kick command

The player gets kicked before the client message is displayed to that player. So, delay the kick using
Code:
SetTimerEx("KickEx", 1100, false, "d", IDPkick);  // in command 


forward KickEx(id);
public KickEx(id)
{
  return Kick(id);
}
SiaReyes is offline   Reply With Quote
Old 13/03/2020, 07:38 PM   #3
RuggieroY
Little Clucker
 
Join Date: Dec 2019
Posts: 2
Reputation: 0
Default Re: Help with kick command

Ok thank you
RuggieroY is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Kick Command Bug Lixyde Scripting Help 3 24/03/2018 04:58 PM
Help with kick command Stoyanov Scripting Help 10 02/03/2015 11:19 AM
Kick command is kicking the player using the command Josh_Main Scripting Help 13 28/09/2014 04:02 PM
Made /kick Command to Kick Player from Virtual World... MAFIAWARS Scripting Help 11 28/09/2013 03:39 PM
/ban and /kick command help Goldilox Scripting Help 11 26/04/2013 02:30 PM


All times are GMT. The time now is 10:01 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.