[Include] OnPlayerUseVending.inc
#1

What is this?
This include calls the function OnPlayerUseVending when a player uses a vending machine (Sprunk or other).
When a player presses F, a timer gets started. If the player has the vending animation (1660) applied, he must be using a vend machine.
This is my first include, so it might not be the best optimized include.

Use
This include can be used for creating a health anticheat or changing the ammount of money a player pays when he uses a vending machine. Eg:
Код:
#include <OnPlayerUseVending>

[...]

OnPlayerUseVending(playerid){
    realHealth[playerid] += 35;
    if(realHealth[playerid]>100) realHealth[playerid] = 100;
    realMoney[playerid] -= 200;
    GameTextForPlayer(playerid, "~r~-$200", 3000, 1);
}
It's highly unlikely that a hacker will press F, apply the vending animation and then update his health to +35.

This can also be used to get more money from the player when he uses a vending machine.

Download
Solidfiles - http://www.solidfiles.com/d/3750704fdb/
Github - https://raw.github.com/i0ni/vending....er/vending.inc
Pastebin - http://pastebin.com/suFe3mKn

Changelog
0.1 - first version
0.1a - fixed a hook bug.

Bugs
None found. Report if you find any bugs.
I used this for like 2 months on my server (100-200 players online) and I found no bugs with it.
No need to detect the position of sprunk machines. I checked all the threads that contained the positions of the sprunk machines before making this include and all of them had some sprunk machines left out. Also, I'm using some custom sprunk machines and I'm applying the sprunk drinking animation to detect those.
Works ok on 0.3e, 0.3x. It will most likely also work with the future versions of SA:MP.

More
[Include] vending.inc - this does the same thing as my include, it also detect the positions of the vending machines and allows the creating of custom sprunk machines. I didn't test that, but it may be better for you if you need something more. At the time at creating my include this didn't exist.
Reply


Messages In This Thread
OnPlayerUseVending.inc - by im - 11.08.2012, 09:53
Re: OnPlayerUseVending.inc - by FireCat - 11.08.2012, 10:16
Re: OnPlayerUseVending.inc - by im - 11.08.2012, 10:17
Re: OnPlayerUseVending.inc - by FireCat - 11.08.2012, 11:29
Re: OnPlayerUseVending.inc - by SuperViper - 11.08.2012, 15:57
Re: OnPlayerUseVending.inc - by im - 11.08.2012, 20:42
Re: OnPlayerUseVending.inc - by DartakousLien - 12.08.2012, 00:03
Re: OnPlayerUseVending.inc - by Emily_Miku - 16.08.2012, 02:05
Re: OnPlayerUseVending.inc - by changeME - 14.01.2013, 01:32

Forum Jump:


Users browsing this thread: 1 Guest(s)