Quote:
Originally Posted by X-olent
Code:
#include <amxmodx>
#include <fakemeta>
#define OFFSET_MONEY 115
#define cs_get_user_money(%1) get_pdata_int(%1, OFFSET_MONEY)
public client_disconnect(plr)
{
new money = cs_get_user_money(plr);
// money holds the player's money
return PLUGIN_CONTINUE;
}
And if that doesn't work:
Code:
#include <amxmodx>
#include <fakemeta>
#define OFFSET_MONEY 115
#define cs_get_user_money(%1) get_pdata_int(%1, OFFSET_MONEY)
new g_money[33];
public plugin_init()
{
register_event("Money", "EventMoney", "b");
}
public client_connect(plr)
{
g_money[plr] = 0;
}
public client_disconnect(plr)
{
// g_money[plr] holds the player's money
}
public EventMoney(plr)
{
g_money[plr] = cs_get_user_money(plr);
return PLUGIN_CONTINUE;
}
Or, if you don't want to use fakemeta:
Code:
#include <amxmodx>
new g_money[33];
public plugin_init()
{
register_event("Money", "EventMoney", "b");
}
public client_connect(plr)
{
g_money[plr] = 0;
}
public client_disconnect(plr)
{
// g_money[plr] holds the player's money
}
public EventMoney(plr)
{
g_money[plr] = read_data(1);
return PLUGIN_CONTINUE;
}
|
That's pretty much what I'm doing now but when I make the plugin client_print when the Money event is called, I see it called many many times; at every item buy, every kill, round start. I was trying to find a way that didn't require so many updates. I know probably 90% of the time client_disconnect would allow me to get the users money but since theres that 10% where it won't work (because user is already disconnected) I really don't want to use it.
Thanks for the reply +karma
__________________