Infinite ammo - 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: Infinite ammo (
/showthread.php?tid=587758)
Infinite ammo -
jamal1992 - 02.09.2015
Hi guys, how i can do to detect infinite ammo of weapons ?
Re: Infinite ammo -
Dokins - 02.09.2015
You could use OnPlayerUpdate and check if their ammo is above 99999 using GetPlayerAmmo(playerid);
Re: Infinite ammo -
jamal1992 - 02.09.2015
I trying this and don`t work, show me the ammo and no decreases. Any ideea ?
Re: Infinite ammo -
Logofero - 02.09.2015
Quote:
Originally Posted by jamal1992
I trying this and don`t work, show me the ammo and no decreases. Any ideea ?
|
You need bullets to be visible? If greater than 10,000 rounds are not visible
Re: Infinite ammo -
jamal1992 - 02.09.2015
When i run cheat and set infinite ammo and no reload, the bullets it`s same like before i do that, so don`t set a specific number. What i must to do ?
AW: Infinite ammo -
Nero_3D - 02.09.2015
Than check if he is shooting with OnPlayerKeyStateChange and watch if the ammo goes down, or not if he is cheating
Re: AW: Infinite ammo -
Logofero - 02.09.2015
Quote:
Originally Posted by Nero_3D
Than check if he is shooting with OnPlayerKeyStateChange and watch if the ammo goes down, or not if he is cheating
|
I see you not like OnPlayerUpdate a always OnPlayerKeyStateChange
Re: Infinite ammo -
jamal1992 - 02.09.2015
To OnplayerKeyStateChange must to set timer for player ... and i think is not verry good. I continue to search an other way.
Re: Infinite ammo -
jamal1992 - 03.09.2015
bump
Re: Infinite ammo -
Logofero - 03.09.2015
Other methods do not. You can do this via the Memory hack, but it will be more difficult.
PHP код:
new bool:p_infinity[MAX_PLAYERS];
#define MAX_INFINITY_AMMO (9999)
public OnPlayerSpawn(playerid) {
p_infinity[playerid] = true;
return 1;
}
public OnPlayerUpdate(playerid) {
static
p_ammo[MAX_PLAYERS]
;
new weaponid = GetPlayerWeapon(playerid);
if (p_infinity[playerid] && weaponid && p_ammo[playerid] > GetPlayerAmmo(playerid) || p_ammo[playerid] < MAX_INFINITY_AMMO) {
GivePlayerWeapon(playerid, weaponid, MAX_INFINITY_AMMO);
SetPlayerAmmo(playerid, weaponid, MAX_INFINITY_AMMO);
p_ammo[playerid] = MAX_INFINITY_AMMO;
}
return 1;
}