Detecting when a player buys food/gambles/mods a car
#1

I've just been playing with the callbacks for these in the useful functions.inc from the wiki.
Can't seem to get any of them to work properly so i just ended getting rid of it all.
What i did just as a test was make it send a message saying "this works", to well.. see if it did. But it didn't.
The only thing it seems to do is display that message when i gmx the server, i tried it in a filterscript too, and it just displayed it after i loaded it.
Any ways of checking if a, player buys food/mods a car/gambles, that work?
Ammunations i'm not too bothered about as i've disabled those.
Reply
#2

well you can use sendclientmessage so the player knows if he really got the item or not.
Reply
#3

OnVehicleMod and OnVehicleRespray are called when a car is modded/changed color. Although I'm not exactly sure if it gets called if the car isn't in a modshop.

You can detect when a player buys something from a vending machine with this code. It works about 95% of the time.

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(RELEASED(KEY_SECONDARY_ATTACK))
    {  
        if(GetPlayerAnimationIndex(playerid) == 1660) // By Vince
            return OnPlayerUseVendingMachine(playerid); // <= make this callback somewhere
    }
    return 1;
}
I presume that gambling can be detected using OnPlayerKeyStateChange aswell.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)