/kick help
#1

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;
	}
Reply
#2

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

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

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

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

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


Forum Jump:


Users browsing this thread: 3 Guest(s)