[Help]Virtual Ammo
#1

Hello i wan't to create something like virtual ammo for my server anticheat...
at the moment it bans all the players who doesn't have unlimited ammo...

is it possible to do something like this ?

#define AMMO 100
forward OnPlayerShot()
public OnPlayerShot()
{
AMMO -1
}
Reply
#2

No. It has to be done through a callback.
Reply
#3

could you just show me an example how to detect if player shoted a bullet ?
i will try to do else myself
Reply
#4

untested

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if (newkeys & KEY_FIRE)
    {
        if (!IsPlayerInAnyVehicle(playerid))
        {
            new wep = GetPlayerWeapon(playerid)
            if (wep > 0 || wep < 50)
            {
                return PlayerShot;
            }
        }
    }
    return 1;
}
it basically check all the conditions that has to be for a player to shot (at least when he is on foot).
Reply
#5

You really don't have to worry about a player losing ammo, you DO have to worry about a player gaining ammo however, all you have to do is see if the player is gaining ammo, but hasn't paid for it, or picked up a weapon.
Reply
#6

admantis
thats nice idea thanks ...

Quote:

You really don't have to worry about a player losing ammo, you DO have to worry about a player gaining ammo however, all you have to do is see if the player is gaining ammo, but hasn't paid for it, or picked up a weapon.

not really ... Virtual Ammo is perfect idea thought...

there is no way that user can gain my virtual ammo without buying it on the server...
if he will cheat he will only get normal ammo... and all guns without virtual ammo will be banned...

i will start scripting tomorrow
Reply
#7

Quote:
Originally Posted by SilentHuntR
Посмотреть сообщение
You really don't have to worry about a player losing ammo, you DO have to worry about a player gaining ammo however, all you have to do is see if the player is gaining ammo, but hasn't paid for it, or picked up a weapon.
I find your statement incorrect, most ammo cheaters I've seen have either had negative ammo or their ammo doesn't move, what you need to do is check if it's negative and not equal to -1, can't really detect the people who don't lose ammo without actually watching them.
Even if you stored the ammo they bought and check to see if they lose ammo after they killed someone with that weapon a cheater could use the fake kill and they'd be punished
Reply
#8

Quote:

can't really detect the people who don't lose ammo without actually watching them.

Wrong, you can check if player has ammo cheat or not, in 5 easy steps:

1. Get info about current ammo (new ammoStatus1 // just an variable example)
2. Remove 1 bullet from current ammo (ammoStatus1 -= 1)
3. Get info about current ammo (new ammoStatus2 // just an variable example)
4. Compare ammoStatus2 with ammoStatus1
> If they are same > POSSIBLE hack > Recheck! (for 2 times, if all are same, its a hack!)
> If there is less > Ammo gets lower = not hack
> If there is more > playe might buyed a gun or picked it up > Recheck!
5. If everything is okay, return 1 bullet to current ammo.

No time to write the code :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)