Kick Timer - 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 Timer (
/showthread.php?tid=458913)
Kick Timer -
George0305 - 19.08.2013
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!
Re: Kick Timer -
Edix - 19.08.2013
Are you trying to create a public inside of a public? because thats the problem.
Re: Kick Timer -
George0305 - 19.08.2013
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;
}
Re: Kick Timer -
George0305 - 19.08.2013
Anyone?
Re: Kick Timer -
ThaCrypte - 19.08.2013
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);
}
Re: Kick Timer -
George0305 - 19.08.2013
Oh,i understood and it`s working now.Thanks!+rep
Re: Kick Timer -
ThaCrypte - 20.08.2013
Quote:
Originally Posted by George0305
Oh,i understood and it`s working now.Thanks!+rep
|
no problem :P