AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check Money (https://forums.alliedmods.net/showthread.php?t=334152)

ConorCC 09-02-2021 03:18

Check Money
 
Hey there!

Effective way to hook money change? I didn't find any solution. Maybe because it is not possible. I want to see the increment or decrement value and not the result value.

HamletEagle 09-02-2021 08:44

Re: Check Money
 
I don't think there is a simple solution. Plugins can either use cs_set_ser_money(so you could hook Money message) or directly set m_iAccount with set_pdata_int. To detect the latter you will have to hook set_pdata_int with orpheu. Then you also need to check when the game updates the user's money, but this will likely be easier, as there are fewer places where it happens(buy menu, round bonuses, etc).
This approach isn't that great and doesn't account for 3rd party modules updating money.

Another way would be to try some kind of brute force approach. Hook something like PreThink or a thinking entity with a small think time and constantly check if the money amount was changed.

Natsheh 09-02-2021 11:15

Re: Check Money
 
try register_messsge(get_user_msgid("Account"), "fw_msg_money")

DJEarthQuake 09-02-2021 12:08

Re: Check Money
 
Quote:

Originally Posted by ConorCC (Post 2756744)
Hey there!

Effective way to hook money change? I didn't find any solution. Maybe because it is not possible. I want to see the increment or decrement value and not the result value.

Money

This message updates the amount of money on the HUD. If the Flag is 1, the amount of money added will also be displayed.

ConorCC 09-02-2021 13:59

Re: Check Money
 
I don't think Account is a real event. It is not listed on this page https://wiki.alliedmods.net/Half-Life_1_Game_Events

And the Money one only delivering the new value.

I just want to hook the basic money changes like bomb plant, kill, win or lose. For now I doing this with different events and logevents. But I want to do it more clever. That's why I ask.

Natsheh 09-02-2021 14:17

Re: Check Money
 
Account is a new event it shows the money on the scoreboard.

DJEarthQuake 09-02-2021 15:00

Re: Check Money
 
Quote:

Originally Posted by ConorCC (Post 2756811)
I don't think Account is a real event. It is not listed on this page https://wiki.alliedmods.net/Half-Life_1_Game_Events

And the Money one only delivering the new value.

I just want to hook the basic money changes like bomb plant, kill, win or lose. For now I doing this with different events and logevents. But I want to do it more clever. That's why I ask.


Post existing code that isn't clever enough.


All times are GMT -4. The time now is 02:38.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.