/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <cstrike>
#include <fakemeta_util>
#define PLUGIN "Money In Deadbody"
#define VERSION "2.0"
#define AUTHOR "6almasok"
new const c_iModel[] = "models/dollarmdl/dollar.mdl"
new iCvar[4], fm_Null = FM_NULLENT;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
iCvar[0] = register_cvar("mid_entkillonstart", "1")
iCvar[1] = register_cvar("mid_mingotmoney", "100")
iCvar[2] = register_cvar("mid_maxgotmoney", "500")
iCvar[3] = register_cvar("mid_useglowcolor", "1")
register_forward(FM_Touch, "moneyTouched")
register_event("DeathMsg","dropMoney","a" );
if(get_pcvar_num(iCvar[0])) register_logevent("killEntity", 2, "1=Round_Start" );
}
public plugin_precache() precache_model(c_iModel)
public dropMoney() {
new Float:fOrigin[3]
new fEnt = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
new Victim = read_data(2)
if(Victim == 0) return;
pev(Victim, pev_origin, fOrigin)
set_pev(fEnt, pev_classname, "Money")
engfunc(EngFunc_SetModel, fEnt, c_iModel)
set_pev(fEnt,pev_solid, SOLID_BBOX)
set_pev(fEnt, pev_movetype, MOVETYPE_TOSS)
engfunc(EngFunc_SetOrigin, fEnt, fOrigin)
engfunc(EngFunc_SetSize, fEnt, Float:{-10.0,-10.0,0.0}, Float:{10.0,10.0,25.0})
engfunc(EngFunc_DropToFloor, fEnt)
if(get_pcvar_num(iCvar[3])) {
set_pev(fEnt, pev_renderfx, kRenderFxGlowShell)
set_pev(fEnt, pev_rendercolor, Float:{255.0, 255.0, 255.0})
}
}
public moneyTouched(ent, id) {
new findEnt[32]
pev(ent, pev_classname, findEnt, charsmax(findEnt))
if(!equal( findEnt, "Money")) return PLUGIN_HANDLED;
if(!pev_valid(ent)) return PLUGIN_HANDLED;
if(!is_user_alive(id)) return PLUGIN_HANDLED;
new RandomNum = random_num(get_pcvar_num(iCvar[1]), get_pcvar_num(iCvar[2]))
cs_set_user_money(id, cs_get_user_money(id)+RandomNum)
client_print(id, print_chat, "[%s] Talaltal +$%i-t egy halottbol!", PLUGIN, RandomNum)
engfunc(EngFunc_RemoveEntity, ent)
return PLUGIN_HANDLED;
}
public killEntity() while((fm_Null = fm_find_ent_by_class(fm_Null, "Money"))) engfunc(EngFunc_RemoveEntity, fm_Null)