AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Catch when a player loose some amount of money (https://forums.alliedmods.net/showthread.php?t=154540)

tuty 04-10-2011 04:26

Catch when a player loose some amount of money
 
How to properly catch when a player spend some money, or his money decrease?

Exolent[jNr] 04-10-2011 04:27

Re: Catch when a player loose some amount of money
 
Hook the "Money" event and check the new value against the old value?

tuty 04-10-2011 09:34

Re: Catch when a player loose some amount of money
 
if you could show me an example cuz i'm confused :D

ConnorMcLeod 04-10-2011 10:22

Re: Catch when a player loose some amount of money
 
It seems that you start coding ???

PHP Code:

#include <amxmodx>

#define MAX_PLAYERS        32

#define VERSION "0.0.1"
#define PLUGIN ""

new g_iLastMoney[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_event("Money""Event_Money""b")
}

public 
Event_Moneyid )
{
    new 
iMoney read_data(1)
    new 
iMoneyDiff g_iLastMoney[id] - iMoney
    g_iLastMoney
[id] = iMoney
    
if( iMoneyDiff )
    {
        
// player has lost $iMoneyDiff
    
}



tuty 04-10-2011 14:00

Re: Catch when a player loose some amount of money
 
Quote:

Originally Posted by ConnorMcLeod (Post 1447139)
It seems that you start coding ???

PHP Code:

#include <amxmodx>

#define MAX_PLAYERS        32

#define VERSION "0.0.1"
#define PLUGIN ""

new g_iLastMoney[MAX_PLAYERS+1]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSION"ConnorMcLeod")
    
register_event("Money""Event_Money""b")
}

public 
Event_Moneyid )
{
    new 
iMoney read_data(1)
    new 
iMoneyDiff g_iLastMoney[id] - iMoney
    g_iLastMoney
[id] = iMoney
    
if( iMoneyDiff )
    {
        
// player has lost $iMoneyDiff
    
}



yeah :))


All times are GMT -4. The time now is 20:11.

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