Anti-cheat didn't work -
Bogdan1992 - 19.01.2012
I have this anti-cheat and when i try to hack a wep i always get banned but today i saw a guy spawning weps killing around and he didnt get banned.
How should i get them easily.
PHP код:
public OnGameModeInit()
{
SetTimer("WeaponCheck",2000,1);
return 1;
}
public WeaponCheck()
{
new playerid, IP[16];
if( PlayerInfo[playerid][pAdmin] >=1 ) return 0;
if( WeaponGiven[playerid] == 1 ) return 0;
if( Logged[playerid] == 1 )
{
new weaponid = GetPlayerWeapon( playerid );
if( ( weaponid >= 1 && weaponid <=45 ) )
{
GetPlayerName( playerid, Nam, sizeof Nam );
GetPlayerIp( playerid, IP, 16 );
format( mystring, sizeof mystring, "Admin-Log: %s has been banned for weapon hack(%s).", Nam, IP);
SendAdminMessage( COLOR_RED, mystring );
BanEx(playerid, "WEAPON HACK");
}
}
return 1;
}
Re: Anti-cheat didn't work -
Sascha - 19.01.2012
that won't work unless you are ID 0
You need a loop to check through all players..
try this:
pawn Код:
public WeaponCheck()
{
new IP[16];
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
if(!IsPlayerConnected(playerid)) return 0;
if( PlayerInfo[playerid][pAdmin] >=1 ) return 0;
if( WeaponGiven[playerid] == 1 ) return 0;
if( Logged[playerid] == 1 )
{
new weaponid = GetPlayerWeapon( playerid );
if( ( weaponid >= 1 && weaponid <=45 ) )
{
GetPlayerName( playerid, Nam, sizeof Nam );
GetPlayerIp( playerid, IP, 16 );
format( mystring, sizeof mystring, "Admin-Log: %s has been banned for weapon hack(%s).", Nam, IP);
SendAdminMessage( COLOR_RED, mystring );
BanEx(playerid, "WEAPON HACK");
}
}
}
return 1;
}
Re: Anti-cheat didn't work -
Michael@Belgium - 19.01.2012
pawn Код:
public WeaponCheck()
{
new IP[16];
for(new i = 0 ; i <= MAX_PLAYERS ; i++ )
if( PlayerInfo[i][pAdmin] >=1 ) return 0;
if( WeaponGiven[i] == 1 ) return 0;
if( Logged[i] == 1 )
{
new weaponid = GetPlayerWeapon( i );
if( ( weaponid >= 1 && weaponid <=45 ) )
{
GetPlayerName( i, Nam, sizeof Nam );
GetPlayerIp( i, IP, 16 );
format( mystring, sizeof mystring, "Admin-Log: %s has been banned for weapon hack(%s).", Nam, IP);
SendAdminMessage( COLOR_RED, mystring );
BanEx(i, "WEAPON HACK");
}
}
return 1;
}
EDIT: lol just same @above
Re: Anti-cheat didn't work -
Bogdan1992 - 19.01.2012
From Sascha works but still for id 0, and from Michael doesn't work...
Re: Anti-cheat didn't work -
GamingTurf - 19.01.2012
Use OnPlayerUpdate to check for hacks. It's better IMO than using a timer to loop through all the player's.
Re: Anti-cheat didn't work -
Bogdan1992 - 19.01.2012
I don't want to use OnPlayerUpdate.
Re: Anti-cheat didn't work -
2KY - 19.01.2012
pawn Код:
public WeaponCheck()
{
new
IP[16]
;
for ( new i = 0; i < MAX_PLAYERS; i++) { //Loop.
if(PlayerInfo[i][pAdmin] >= 1) return 0;
if(WeaponGiven[i] == 1) return 0;
if( Logged[i] == 1 )
{
if(GetPlayerWeapon(i) >= 1 && GetPlayerWeapon(i) <= 45) { //Is this just to test your anti cheat? Cause this will ban for all weapons..
new
p_Name[24],
mystring[128]
;
GetPlayerName( i, p_Name, sizeof( p_Name ));
GetPlayerIp( i, IP, 16 );
format( mystring, sizeof mystring, "Admin-Log: %s has been banned for weapon hack(%s).", p_Name, IP);
SendAdminMessage( COLOR_RED, mystring );
BanEx(i, "WEAPON HACK");
}
}
}
return 1;
}
Try that.
Re: Anti-cheat didn't work -
Vince - 19.01.2012
Replace
return 0 with
continue and you're set.
Re: Anti-cheat didn't work -
Bogdan1992 - 19.01.2012
Thanks everyone for helping me. Works perfect now.
Re: Anti-cheat didn't work -
Tigerkiller - 19.01.2012
to make the public faster, use this in the loop
pawn Код:
if(!IsPlayerConnected(i)) continue;