Kicking the victim
#1

I have no idea why its kicking the admin who uses it and not the user that must be kick here's the code

Код:
CMD:kick(playerid, params[])
{
	if(PlayerInfo[playerid][pAdmin] >= 1)
	{
		new string[128], giveplayerid, reason[64];
		if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid/partofname] [reason]");

		if(IsPlayerConnected(giveplayerid))
		{
			if(PlayerInfo[giveplayerid][pAdmin] < PlayerInfo[playerid][pAdmin]) {
				new playerip[32];
				GetPlayerIp(giveplayerid, playerip, sizeof(playerip));
				format(string, sizeof(string), "AdmCmd: %s (IP:%s) was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), playerip, GetPlayerNameEx(playerid), reason);
				Log("logs/kick.log", string);
				format(string, sizeof(string), "AdmCmd: %s was kicked by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
				SendClientMessageToAllEx(COLOR_LIGHTRED, string);
				/*format(string, sizeof(string), "You have been kicked out by %s, reason: %s. Take a screenshot using F8 if you find this abusive.", GetPlayerNameEx(playerid), reason);
				SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);*/
				SetTimerEx("DelayedKick", 250, false, "i", giveplayerid);
			}
			return 1;
		} else SendClientMessage(playerid, COLOR_GRAD1, "Invalid player specified.");
	}

	return 1;
}
The

Код:
forward DelayedKick(playerid);
public DelayedKick(playerid)
{
	Kick(playerid);
	return 1;
}
It must kick the player and not the admin who using it. +1 Rep
Reply
#2

BUMP!
Reply
#3

250ms? Why?Not bad change to 1000ms (1sec)
Код:
SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
Reply
#4

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
250ms? Why?Not bad change to 1000ms (1sec)
Код:
SetTimerEx("DelayedKick", 1000, false, "i", giveplayerid);
I also tried that thing. But it's very slow to kick i like a very fast that the player still can get the kick msg
Reply
#5

pawn Код:
SetTimerEx("DelayedKick", 1000, false, "d", giveplayerid);
/* dont use 250ms might still dont receive SCM when it comes to a slow internet of player use 1000ms for a safer one
specifier i- interger
 Specifier d - decimal
Still de same*/

forward DelayedKick(targetid);
public DelayedKick(targetid)
    Return Kick(targetid);
Im at mobile btw
Reply
#6

Quote:
Originally Posted by ToiletDuck
Посмотреть сообщение
pawn Код:
SetTimerEx("DelayedKick", 1000, false, "d", giveplayerid);
// dont use 250ms might still dont receive SCM when it comes to a slow internet of player use 1000ms for a safer one

forward DelayedKick(targetid);
public DelayedKick(targetid)
    Return Kick(targetid);
Im at mobile btw
Which will be kicked the giveplayerid ?

Код:
forward DelayedKick(targetid);
public DelayedKick(targetid)
	Return Kick(targetid);
Is this the same with playerid ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)