Messages and Kick in 0.3x
#1

I have 4 functions that will kick a player in casse smth happens. I have login kicker, locked server kicked, fps kicker and ping kicker, 2 of them are called in onplayerconnect and i get the message with the kick message with the reason, however the other 2 are called in onplayerupdate and i dont get the message.

Код:
public OnPlayerConnect(playerid) {
	Players[playerid][Kicked] = false;

	// Login
	if (!Players[playerid][LogIn]) { // /login <Password>
		SetTimerEx("Update_Login_Kicker", 30000, 0, "i", playerid);

		format(cmdstr, 150, "[Account Info] You have 30 Seconds to type /login <Password>");
		SendClientMessage(playerid, ACC_COLOR, cmdstr); }

	// Server Lock
	if (Server[Lock]) {
		SetTimerEx("Update_Lock_Kicker", 30000, 0, "i", playerid);

		SendClientMessage(playerid, SERVER_COLOR, "[Server Info] You have 30 Seconds to type /pass <Password>"); }

	return 1; }

public OnPlayerDisconnect(playerid, reason) {
	if (!Players[playerid][Kicked]) switch (reason) {
		case 0: format(cmdstr, 150, "*** %s has left the server (Timeout)", Players[playerid][Name]);
		case 1:	format(cmdstr, 150, "*** %s has left the server (Leaving)", Players[playerid][Name]);
		case 2:	format(cmdstr, 150, "*** %s has left the server (Kicked/Banned)", Players[playerid][Name]); }

	SendClientMessageToAll(COLOR, cmdstr);

	return 1; }

public OnPlayerUpdate(playerid) {
	Update_FPS_Kicker(playerid);
	Update_Ping_Kicker(playerid);
	return 1; }

Update_FPS_Kicker (playerid) {
	...
	if (!Players[playerid][Kicked] && Players[playerid][FPSWarnings] > 50) {
		format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Low FPS)", Players[playerid][Name]);
        SendClientMessageToAll(COLOR, cmdstr);

        Players[playerid][Kicked] = true;
        SetTimerEx("KickPlayer", 1, false, "i", playerid); }

	return 1; }

Update_Ping_Kicker (playerid) {
	...
	if (!Players[playerid][Kicked] && Players[playerid][PingWarnings] > 5) {
		format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: High Ping)", Players[playerid][Name]);
        SendClientMessageToAll(COLOR, cmdstr);

        Players[playerid][Kicked] = true;
        SetTimerEx("KickPlayer", 1, false, "i", playerid); }

	return 1; }

forward Update_Login_Kicker (playerid);
public Update_Login_Kicker (playerid) {
    if (!Players[playerid][Kicked] && !Players[playerid][LogIn]) {
	    format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Fail Login)", Players[playerid][Name]);
        SendClientMessageToAll(COLOR, cmdstr);

        Players[playerid][Kicked] = true;
        SetTimerEx("KickPlayer", 1, false, "i", playerid); }

	return 1; }

forward Update_Lock_Kicker (playerid);
public Update_Lock_Kicker (playerid) {
    if (!Players[playerid][Kicked] && !Players[playerid][Unlock] && Server[Lock]) {
	    format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Server Lock)", Players[playerid][Name]);
        SendClientMessageToAll(COLOR, cmdstr);

        Players[playerid][Kicked] = true;
        SetTimerEx("KickPlayer", 1, false, "i", playerid); }

	return 1; }
I already tried to call Update_FPS_Kicker and Update_Ping_Kicker with a time and it didnt worked either...
Plus in the 4 cases everytime someone is kicked by this 4 function the kick message appears 2 times. Like:
*** P3DRO has left the server (Kicked || Reason: Server Lock)
*** P3DRO has left the server (Kicked || Reason: Server Lock)

Pls help
Reply
#2

Replace this line:
pawn Код:
SetTimerEx("KickPlayer", 1, false, "i", playerid);
with this:
pawn Код:
SetTimerEx("KickPlayer", 1000, false, "i", playerid); // Kicks player after one second
Remember that the interval for SetTimerEx is in milliseconds, thus 1000 is equal to 1 second.
Reply
#3

i already tried that either, even with 30000 (30 seconds) like the others and nothing :c but thanks for our reply
Reply
#4

Try this:

pawn Код:
forward Update_FPS_Kicker(playerid);
forward Update_Ping_Kicker(playerid);

public Update_FPS_Kicker(playerid)
{

}

public Update_Ping_Kicker(playerid)
{

}
Reply
#5

already did...but i tried it again and it worked, but that only fixes half of the problem. what im gonna do with the duplicated messages?
Reply
#6

bump
Reply
#7

pawn Код:
forward KickPublic(playerid)
public KickPublic(playerid)
{
    Kick(playerid);
}
KickEx(playerid)
{
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);
}
replace all kick timers with KickEx(playerid); should work
Reply
#8

the problem is not kicking the player.
Код:
forward Kicker_Lock (playerid);
public Kicker_Lock (playerid) {
    if (!Players[playerid][Leaving] && !Players[playerid][Unlock] && Server[ServerLock]) {
	    format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Server Lock)", Players[playerid][Name]);
	    SendClientMessageToAll(COLOR, cmdstr);

	    Players[playerid][Leaving] = true;
	    SetTimerEx("KickPlayer", 1, false, "i", playerid); }

	return 1; }
the
Код:
format(cmdstr, 150, "*** %s has left the server (Kicked || Reason: Server Lock)", Players[playerid][Name]);
appears two times. like:
Код:
*** P3DRO has left the server (Kicked || Reason: Server Lock)
*** P3DRO has left the server (Kicked || Reason: Server Lock)
and it should only appear one time
Reply
#9

hm can we see your "KickPlayer" timer?
Reply
#10

Код:
forward KickPlayer(playerid);
public KickPlayer(playerid) { Kick(playerid); return 1; }
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)