The amount of money over the prescribed limit, to touch the money model prompted the emergence of non-stop.
How to make prompt appears only once, to model the time to touch?
PHP Code:
public plugin_init()
{
register_touch("MoneyEnt", "player", "money_touch")
}
public money_touch(ptr, ptd)
{
if (total_money[ptd] >= 100000)
{
new msg[256]
format(msg, 255, "^x03Your money more than ^x04$100000^x03 not need to pick.")
color_saytext(msg, MSG_ONE, ptd, 3)
}
if (is_user_alive(ptd) && (total_money[ptd] < g_maxmoney))
{
new owner = entity_get_edict(ptr, EV_ENT_owner)
new Float:droptime = entity_get_float(ptr, EV_FL_fuser1)
if(owner==ptd && get_gametime()-droptime<0.3) return
new money = entity_get_int(ptr, EV_INT_iuser2)
add_player_money(ptd, money)
new usergetmoney = money
if (usergetmoney > 999)
{
new name[32]
get_user_name(ptd, name, 31)
new msg[256]
format(msg, 255, "^x03%s^x01 pick up ^x03$%d", name, usergetmoney)
client_color(0, ptd, msg)
}
new leftmoney = money - usergetmoney
if (leftmoney < g_maxmoney)
{
remove_entity(ptr)
droped_money_count--
} else {
entity_set_int(ptr, EV_INT_iuser2, leftmoney)
if (leftmoney < 5000)
entity_set_model(ptr, g_MoneyModel[2])
else if (leftmoney < 10000)
entity_set_model(ptr, g_MoneyModel[1])
else
entity_set_model(ptr, g_MoneyModel[0])
new Float:maxbox[3] = {15.0, 15.0, 15.0}, Float:minbox[3] = {-15.0, -15.0, -15.0}
entity_set_size(ptr, minbox, maxbox)
}
}
}