little problem with my weapon anticheat
#1

well i made a anticheat and i want that when the player lost his weapon by lost all the ammo he gets the variable off but that isnt hapening. every weapon i create is getting the variable and the script see the weapon as cheated.

the code:
if( GetPlayerWeaponState( playerid ) == WEAPONSTATE_NO_BULLETS )
{
new weap = GetPlayerWeapon(playerid);
Weapon[playerid][weap] = false;
return 1;
}

i put that in onplayerupdate.
sorry for my bad english
Reply
#2

You can use GetPlayerAmmo, it returns the ammo on their current weapon, but read the WIKI for an important note.
If it returns 0, then set the variable about the current weapon to false. Something like this:
pawn Код:
new
    weap = GetPlayerWeapon( playerid )
    ammo = GetPlayerAmmo( playerid )
;
if( ammo == 0 ) Weapon[ playerid ][ weap ] = false;
Even though, I'd suggest you not to use GetPlayerWeapon, but your own function that it registers the weapons to the server (server-side weapons). If the weapon is not registered, then return -1 and make it as weapon cheats detection.
Reply
#3

i made a good weapon system you need to get weapons by the server side functions and if you get in another way you get banned. i just found this "bug" i am trying to fix it. thanks for the idea i gonna do it right now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)