SA-MP Forums Archive
/kick 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 help (/showthread.php?tid=513558)



/kick help - jamjamnewbie - 17.05.2014

I've been doing a kick command but its strange that the sendclientmessagetoall is being processed AFTER the Kick(targetid). Anyone how to fix this?
Код:
CMD:kick(playerid, params[]) {
	if(!IsPlayerAdmin(playerid)) {
	    new targetid;
	    new reason[128];
	    new string[256];
	    new pName[MAX_PLAYER_NAME];
	    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "That player isn't connected.");
	    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick [id] [reason]");
		if(!sscanf(params, "us[128]", targetid, reason)) {
		    GetPlayerName(targetid, pName, sizeof(pName));
		    format(string, sizeof(string), "Server Admin(-1) has kicked %s(%d) < > Reason: %s", pName, targetid, reason);
		    SendClientMessageToAll(COLOR_YELLOW, string);
		    Kick(targetid);
		    }
		} else {
		    SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
		}
	return 1;
	}



Re : /kick help - Ramoboss - 17.05.2014

i don't think that we can controll that, it depends on your server speed i guess


Re: /kick help - Dignity - 17.05.2014

Use a timer to kick the targetid a few seconds after the message was sent.


Re : /kick help - Ramoboss - 17.05.2014

yeah but using timers is not very good for the performance of the server...


Re: /kick help - rymax99 - 17.05.2014

https://sampwiki.blast.hk/wiki/Kick

A timer will have to be used as shown in that wiki.