Detect buy success
Hello. Here's basically what I want to do - detect whenever a player buys something, what it is, and the cost. Right now I'm taking the restmenu.sma code for the detection and modifying it. This works fine to detect what a person tried to buy...but how do you figure out if it was successful or not?
I have one main array for players that stores a lot of values, including money. I figured I'd just compare the old money value to the new money value, and if they're different, then the buy was successful. The problem is, the player's money doesn't change right away. I have to delay the check, so it looks like this (only relevant parts included): Code:
register_menucmd(register_menuid("BuyPistol", 1), 511, "menuPistol") |
Re: Detect buy success
Hrmm...after looking a little further, could I use this with the register events like Money, AmmoPickup, WeapPickup, ItemPickup? Seems like I'd have to add a flag to check if the pickup was from a buy event or not (possibly using the Money event as a flag).
|
Re: Detect buy success
You're moving in the right direction. I remember that another user has the similar problem so you have to look here for the technique details: http://forums.alliedmods.net/showthread.php?t=50704
|
Re: Detect buy success
ya know, out of all my searching, i actually found that thread, but never read it all the way through. :) it looks like using the registered events is a much more accurate and efficient way to detect everything i want.
thank you, i should be all set now. if i have any problems i'll post them back in here. |
| All times are GMT -4. The time now is 00:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.