Kick Timer
#1

Hello!I have a problem.I searched on ****** for a solution but none worked.Or i didn`t knew how to make it work.So..my problem is that i have a sendclientmessage,to send player a message for what is him being kicked and its not showed.I know it needs a timer,but i don`t know how to put it.I tried something,take a look at this please.
Код:
C:\Users\George\Desktop\dfghdhs\pawno\include\PPC_PlayerCommands.inc(1517) : error 029: invalid expression, assumed zero
C:\Users\George\Desktop\dfghdhs\pawno\include\PPC_PlayerCommands.inc(1518) : error 029: invalid expression, assumed zero
C:\Users\George\Desktop\dfghdhs\pawno\include\PPC_PlayerCommands.inc(1519) : error 001: expected token: ";", but found "{"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Код:
SendClientMessageToAll(0xFFFFFFFF, Msg);
                                        SetTimerEx("Kick", 1000, false, "d",playerid);
					// Kick the player
					forward Kick(playerid);
                                        public Kick(playerid)
                                        {
                                          return  Kick(playerid);
                                        }
				}
				else
				    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Lines:
Код:
forward Kick(playerid);
                                        public Kick(playerid)
                                        {
Thanks!
Reply
#2

Are you trying to create a public inside of a public? because thats the problem.
Reply
#3

I have no idea..Its in the include in pawn folder.
That`s all the cmd:
Код:
COMMAND:kick(playerid, params[])
{
	new PlayerToKick, Reason[128], Msg[128], Name[24], AdminName[24];

	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true)
	{
		// Check if the player's admin-level is at least 2
		if (APlayerData[playerid][PlayerLevel] >= 2)
		{
			if (sscanf(params, "us[128]", PlayerToKick, Reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/kick <PlayerToKick> <Reason>\"");
			else
				if (IsPlayerConnected(PlayerToKick)) // If the player is a valid playerid (he's connected)
				{
					// Get the name of the player who warned the player
					GetPlayerName(playerid, Name, sizeof(Name));
					// Send the warned player a message who kicked him and why he's been kicked
					format(Msg, 128, "Ai primit kick de la %s %s.Daca crezi ca nu e corect,fa o poza si posteaz-o pe mamaiarp.createaforum.com", AdminLevelName[APlayerData[playerid][PlayerLevel]], Name);
					SendClientMessage(playerid, 0xFF0000FF, Msg);
					format(Msg, 128, "Reason: %s", Reason);
					SendClientMessage(playerid, 0xFF0000FF, Msg);
                    format(Msg, 128, "{808080}%s %s has kicked {FFFF00}%s", AdminLevelName[APlayerData[playerid][PlayerLevel]], AdminName, Name);
					SendClientMessageToAll(0xFFFFFFFF, Msg);
                                        SetTimerEx("Kick", 1000, false, "d",playerid);
					// Kick the player
					Kick(PlayerToKick);
                                        
				}
				else
				    SendClientMessage(playerid, 0xFF0000FF, "That player isn't online");
		}
		else
		    return 0;
	}
	else
	    return 0;

	// Let the server know that this was a valid command
	return 1;
}
Reply
#4

Anyone?
Reply
#5

You shouldn't put the timer there.
Make it like
pawn Код:
COMMAND:kick(playerid, params[])
{
    // CMD
    // When the playername = valid etc etc
    sendclientmessage(PlayerToKick, -1, "You have been kicked")
    SetTimerEx("KickTimer", 15, 0, "d", PlayerToKick);
    return 1;
}
Above that, you make:
pawn Код:
forward KickTimer(playerid);
public KickTimer(playerid)
{
    Kick(playerid);
}
Reply
#6

Oh,i understood and it`s working now.Thanks!+rep
Reply
#7

Quote:
Originally Posted by George0305
Посмотреть сообщение
Oh,i understood and it`s working now.Thanks!+rep
no problem :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)