Detecting when a player buys food/gambles/mods a car - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Detecting when a player buys food/gambles/mods a car (
/showthread.php?tid=265386)
Detecting when a player buys food/gambles/mods a car -
Hobod - 30.06.2011
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.
Re: Detecting when a player buys food/gambles/mods a car -
Madsen - 30.06.2011
well you can use sendclientmessage so the player knows if he really got the item or not.
Re: Detecting when a player buys food/gambles/mods a car -
Vince - 30.06.2011
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.