Anti Ammo hack [REP -_-] - 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: Anti Ammo hack [REP -_-] (
/showthread.php?tid=562633)
Anti Ammo hack [REP -_-] -
nezo2001 - 10.02.2015
Again -_- it bannes player while the are reloading if the pressed the key fire
PHP код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_FIRE))
{
bAmmo[playerid] = GetPlayerAmmo(playerid);
bWeapon[playerid] = GetPlayerWeapon(playerid);
if(GetPlayerWeapon(playerid) < 16 || GetPlayerWeapon(playerid) == 19 || GetPlayerWeapon(playerid) == 20 || GetPlayerWeapon(playerid) == 21 || GetPlayerWeapon(playerid) > 38) return 0;
if(GetPlayerWeaponState(playerid) != WEAPONSTATE_RELOADING)
{
SetTimerEx("check",4000,false,"i",playerid);
}
new string[128];
format(string,sizeof(string),"Ammo %i",bAmmo);
printf(string);
}
return 1;
}
forward check(playerid);
public check(playerid)
{
nAmmo[playerid] = GetPlayerAmmo(playerid);
nWeapon[playerid] = GetPlayerWeapon(playerid);
if(bAmmo[playerid] == nAmmo[playerid] && bWeapon[playerid] == nWeapon[playerid])
{
new string[128];
new name[MAX_PLAYER_NAME], string1[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(pm[playerid] == false && sm[playerid] == false)
{
format(string,sizeof(string),"%s has banned for ammo hack",name);
SendClientMessageToAll(0xAA3333AA,string);
SendClientMessage(playerid, 0xAA3333AA,"You have banned from the server ");
}
printf("Cheat Detect");
SetTimerEx("ban",500,false,"i",playerid);
pm[playerid] = true;
sm[playerid] = true;
#pragma unused string1
}
return 1;
}
Please ....
Re: Anti Ammo hack [REP -_-] -
Tamy - 10.02.2015
This should fix your problem, use OnPlayerWeaponShot instead of KeyStateChange. This will only work if you are using 0.3z.
By the way don't forget to remove those lines from OnPlayerKeyStateChange before you place this code.
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(weaponid < 16 || weaponid == 19 || weaponid == 20 || weaponid == 21 || weaponid > 38) return 0;
bAmmo[playerid] = GetPlayerAmmo(playerid);
bWeapon[playerid] = GetPlayerWeapon(playerid);
SetTimerEx("check",4000,false,"i",playerid);
new string[128];
format(string,sizeof(string),"Ammo %i",bAmmo);
printf(string);
return 1;
}
forward check(playerid);
public check(playerid)
{
nAmmo[playerid] = GetPlayerAmmo(playerid);
nWeapon[playerid] = GetPlayerWeapon(playerid);
if(bAmmo[playerid] == nAmmo[playerid] && bWeapon[playerid] == nWeapon[playerid])
{
new string[128];
new name[MAX_PLAYER_NAME], string1[24+MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
if(pm[playerid] == false && sm[playerid] == false)
{
format(string,sizeof(string),"%s has banned for ammo hack",name);
SendClientMessageToAll(0xAA3333AA,string);
SendClientMessage(playerid, 0xAA3333AA,"You have banned from the server ");
}
printf("Cheat Detect");
SetTimerEx("ban",500,false,"i",playerid);
pm[playerid] = true;
sm[playerid] = true;
#pragma unused string1
}
return 1;
}
Re: Anti Ammo hack [REP -_-] -
nezo2001 - 10.02.2015
Same, The diffiernce that it bannes player withoug even reloading -_-
Re: Anti Ammo hack [REP -_-] -
Tamy - 10.02.2015
I changed the code by editing my previous post, try it now.