ok tnx for the respond.. the main problem is the function already exists (and is used by the /drop), and ofcouse want to use it insteadof copy it to a new function (to save bytes)
ok so if this is the function, how should i fix it?
Code:
public user_drop_money(id,amount)
{
if(!is_user_alive(id)) return PLUGIN_HANDLED
if(is_user_database(id) == 0) {
print_text(id)
return PLUGIN_HANDLED
}
if(amount <= 0) {
client_print(id,print_chat,"[EconomyMod] Usage: /drop <name> <amount>^n")
return PLUGIN_HANDLED
}
new origin[3], authid[32], query[256], wallet, Float:forigin[3]
get_user_origin(id,origin)
get_user_authid(id,authid,31)
format(query,255,"SELECT wallet FROM money WHERE steamid='%s'",authid)
result = dbi_query( dbc, query)
if( dbi_nextrow( result ) <= 0 ) {
dbi_free_result(result)
return PLUGIN_HANDLED
}
wallet = dbi_field(result,1)
dbi_free_result(result)
if(amount > wallet) {
client_print(id,print_chat,"[EconomyMod] You don't have enough money in your wallet!")
return PLUGIN_HANDLED
}
new ent = create_entity("info_target")
if(!ent) return PLUGIN_HANDLED
IVecFVec(origin,forigin)
new Float:minbox[3] = { -2.5, -2.5, -2.5 }
new Float:maxbox[3] = { 2.5, 2.5, -2.5 }
new Float:angles[3] = { 0.0, 0.0, 0.0 }
angles[1] = float(random_num(0,270))
entity_set_vector(ent,EV_VEC_mins,minbox)
entity_set_vector(ent,EV_VEC_maxs,maxbox)
entity_set_vector(ent,EV_VEC_angles,angles)
entity_set_int(ent,EV_INT_solid,SOLID_TRIGGER)
entity_set_int(ent,EV_INT_movetype,MOVETYPE_TOSS)
new moneystr[32]
num_to_str(amount,moneystr,31)
entity_set_string(ent,EV_SZ_targetname,moneystr)
entity_set_string(ent,EV_SZ_classname,"money_pile")
entity_set_model(ent,"models/hwrp/money.mdl")
entity_set_origin(ent,forigin)
g_delay_ent[id] = 2
edit_value(id,"money","wallet","-",amount)
client_print(id,print_chat,"[EconomyMod] You dropped $%i on the ground",amount)
return PLUGIN_HANDLED
}