Anti-Cheat Problem - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Anti-Cheat Problem (
/showthread.php?tid=76644)
Anti-Cheat Problem -
Danny_Costelo - 05.05.2009
pawn Код:
public Antiweapon(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36)
{
format(string, sizeof(string), "%s has been kicked for cheating", playername);
SendClientMessageToAll(ADMIN_RED, string);
banning[i] = 1;
if(banning[i] == 1)
{
Kick(i);
}
return 1;
}
}
}
The problem is it kicks the first player on connect, after one player get's kicked by the anti-cheat, probably if the ID is the same. I also reset the banning variable to 0 on connect.
Anyone know what's wrong?
Re: Anti-Cheat Problem -
Backwardsman97 - 05.05.2009
Shouldn't i be playerid?
Re: Anti-Cheat Problem -
Danny_Costelo - 05.05.2009
Quote:
Originally Posted by backwardsman97
Shouldn't i be playerid?
|
Oh sorry, forgot to post my loop.
Check the first post, I appreciate the reply.
Re: Anti-Cheat Problem -
Think - 05.05.2009
Quote:
Originally Posted by tr0y
pawn Код:
public Antiweapon(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { if (GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36) { format(string, sizeof(string), "%s has been kicked for cheating", playername); SendClientMessageToAll(ADMIN_RED, string); banning[i] = 1; if(banning[i] == 1) { Kick(i); } return 1; } } }
The problem is it kicks the first player on connect, after one player get's kicked by the anti-cheat, probably if the ID is the same. I also reset the banning variable to 0 on connect.
Anyone know what's wrong? 
|
remove the banning variable its a waste of cells, you can just kick the dude you dont need to have an useless variable decide if he needs to be kicked.
Re: Anti-Cheat Problem -
Danny_Costelo - 05.05.2009
Quote:
Originally Posted by Pandabeer1337
Quote:
Originally Posted by tr0y
pawn Код:
public Antiweapon(playerid) { for(new i = 0; i < MAX_PLAYERS; i++) { if (GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36) { format(string, sizeof(string), "%s has been kicked for cheating", playername); SendClientMessageToAll(ADMIN_RED, string); banning[i] = 1; if(banning[i] == 1) { Kick(i); } return 1; } } }
The problem is it kicks the first player on connect, after one player get's kicked by the anti-cheat, probably if the ID is the same. I also reset the banning variable to 0 on connect.
Anyone know what's wrong? 
|
remove the banning variable its a waste of cells, you can just kick the dude you dont need to have an useless variable decide if he needs to be kicked.
|
I know, It's not needed, but the first player connecting keeps getting kicked, I taught reseting that variable on connect would fix the problem.
EDIT: Do I also need a loop, when doing SetTimerEx?
Re: Anti-Cheat Problem -
Joe Staff - 05.05.2009
You haven't got playername defined anywhere also, put parentheses around GetPlayerWeapon(i) and the number, so
((GetPlayerWeapon(i) == 3

|| (GetPlayerWeapon(i) == 35) || (GetPlayerWeapon(i) == 36))
Re: Anti-Cheat Problem -
Byrner - 05.05.2009
Check OnPlayerConnect to see if there's a GivePlayerWeapon line.
If there is, check what ID the weapon the player's receiving is.
Re: Anti-Cheat Problem -
Badger(new) - 27.06.2009
Your origonal one wouldn't work because you return 1; before it can check all players.
well if that's a timer, you could just do:
pawn Код:
public OnGameModeInit()
{
SetTimer("WeapCheck",15000,1);
return 1;
}
pawn Код:
public WeapCheck()
{
for(new i; i<200;i++)
{
if((GetPlayerWeapon(i)==38)||(GetPlayerWeapon(i)==35)||(GetPlayerWeapon(i)==36))
format(string, sizeof(string), "%s has been kicked for cheating", playername);
SendClientMessageToAll(ADMIN_RED, string);
Kick(i);
}
return 1;
}
Re: Anti-Cheat Problem -
Grim_ - 27.06.2009
I don't understand why peopel bump such old topics
Re: Anti-Cheat Problem -
illay - 27.06.2009