change kick system to warn system. - 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: change kick system to warn system. (
/showthread.php?tid=450711)
change kick system to warn system. -
Champ - 14.07.2013
I have a cbug system but when player cbug it directly kicks the player without giving any warning. here is the code ↓
pawn Код:
forward OnPlayerCBug(playerid);
public OnPlayerCBug(playerid) {
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
new str2[128];
format(str2, sizeof(str2), "{F81414}[Anti-Cbug] {FFFFFF}has kicked {F81414}%s {FFFFFF}for Crouch bugging with weapon {F81414}(%s)", playername, aWeaponNames[WeaponID[playerid]]);
SendClientMessageToAll(COLOR_WHITE, str2);
CheckCrouch[playerid] = 0;
Kick(playerid);
return 1;
}
I have tried to add warning system but it was bugged. Help me in changing this to warning system.
Re: change kick system to warn system. -
Mado - 14.07.2013
pawn Код:
new CBugWarns[MAX_PLAYERS];
OnPlayerConnects(playerid)
{
CBugWarns[playerid] = 0;
return 1;
}
public OnPlayerCBug(playerid) {
CBugWarns[playerid] += 1;
if(CBugWarns[playerid] == 3){
Kick(playerid);
//optional messages
}
return 1;
}
Something like that. You store the warnings in a var and every time you detect the player C-bugging you add 1 to it. Once it hits 3 warnins, or any other amount you wish, it'll kick the player.
Re: change kick system to warn system. -
Champ - 14.07.2013
thank you Mado. +1 rep.
Respuesta: change kick system to warn system. -
Xabi - 14.07.2013
Replace the Kick(playerid) function with these:
pawn Код:
stock KickWithMessage(playerid, color, message[])
{
SendClientMessage(playerid, color, message);
SetTimerEx("KickPublic", 500, 0, "d", playerid);
return 1;
}
forward KickPublic(playerid);
public KickPublic(playerid)
{
Kick(playerid);
return 1;
}
Re: change kick system to warn system. -
Mado - 14.07.2013
@Champ; NP, you're welcome.
@Xabi: That is actually a pretty nice way as well, rather than Kick() and a message system apart from each other.
And Champ, make sure you use a timer on the Kick() so the player willa ctually see the message.