BANNED
|
03-04-2007
, 19:27
new bomb script help
|
#1
|
Hi guys,
I need some help on this code:
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fakemeta> #include <engine> #include <cstrike> #include <fakemeta_util> #include <fun>
#define PLUGIN "Molotov Cocktail" #define VERSION "1.0" #define AUTHOR "SAMURAI"
new pnumplugin, pprice, pMldamage, pMlradius new g_hasMolotov[33]; new g_active[33];
new g_restarted new firespr; new g_MaxPlayers
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_clcmd("say /molotov","buy_molotov",0) register_clcmd("say molotov","buy_molotov",0) pnumplugin = register_cvar("molotov_cocktail","1") pprice = register_cvar("molotov_price","1200") pMldamage = register_cvar("molotov_damage","520.0"); pMlradius = register_cvar("molotov_radius","240.0"); // EVENTS register_event("CurWeapon", "Event_CurWeapon","be", "1=1") register_event("HLTV","event_new_round", "a","1=0", "2=0") register_event("TextMsg","Event_GameRestart","a","2=#Game_Commencing","2=#Game_will_restart_in") register_forward(FM_SetModel,"fw_setmodel"); g_MaxPlayers = get_maxplayers()
}
public buy_molotov(id) { if(!get_pcvar_num(pnumplugin)) return PLUGIN_CONTINUE; if(!is_user_alive(id)) { client_print(id,print_center,"You can't buy Molotov Cocktail because you are dead !"); return PLUGIN_HANDLED; } if(!cs_get_user_buyzone(id)) { client_print(id,print_center,"You are not in the BuyZone target !"); return PLUGIN_HANDLED; } new money = cs_get_user_money(id) if(money < get_pcvar_num(pprice)) { client_print(id,print_center,"Your don't have enough $ to buy a Molotov Cocktail"); return PLUGIN_HANDLED; } if(g_hasMolotov[id]) { client_print(id,print_center,"You alearly have a Molotov Cocktail"); return PLUGIN_HANDLED; } new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1]) if(weaponID == CSW_HEGRENADE) { g_active[id] = true set_molotov_model(id) } g_hasMolotov[id] = 1 cs_set_user_money(id,money - get_pcvar_num(pprice)) give_item(id,"weapon_hegrenade") client_print(id,print_chat,"You got a Molotov Cocktail !"); return PLUGIN_HANDLED; }
public set_molotov_model(id) { entity_set_string(id, EV_SZ_viewmodel, "models/v_molotov.mdl") entity_set_string(id, EV_SZ_weaponmodel, "models/p_molotov.mdl") entity_set_model(id,"models/w_molotov.mdl") } public set_hegren_model(id) { entity_set_string(id, EV_SZ_viewmodel, "models/v_hegrenade.mdl") entity_set_string(id, EV_SZ_weaponmodel, "models/p_hegrenade.mdl") entity_set_model(id,"models/w_hegrenade.mdl") } public plugin_precache() { precache_model("models/v_molotov.mdl") precache_model("models/p_molotov.mdl") precache_model("models/w_molotov.mdl") firespr = precache_model("sprites/fire.spr"); } public Event_CurWeapon(id) { if(!is_user_alive(id) || !g_hasMolotov[id]) return PLUGIN_CONTINUE new WeaponID = read_data(2) switch(WeaponID) { case CSW_HEGRENADE: { set_task(0.3, "task_activemolotov", id) set_molotov_model(id) entity_set_int(id, EV_INT_weaponanim, 9) } default: g_active[id] = 0 } return PLUGIN_CONTINUE }
public task_activemolotov(id) { if(!is_user_connected(id) || !is_user_alive(id)) return PLUGIN_CONTINUE new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1]) if(weaponID == CSW_HEGRENADE) g_active[id] = 1 return PLUGIN_CONTINUE; } public Event_GameRestart() { g_restarted = 1 }
public event_new_round() { if(g_restarted) { new Players[32], iNum = 0 get_players(Players, iNum) for(new i = 0; i < iNum; i++) { new id = Players[i] g_active[id] = 0 g_hasMolotov[id] = 0 new temp[2], weaponID = get_user_weapon(id, temp[0], temp[1]) if(weaponID == CSW_HEGRENADE) set_hegren_model(id) g_restarted = 0 } } new molotovs = -1 while((molotovs = find_ent_by_class(molotovs, "molotov"))) remove_entity(molotovs) }
public fw_setmodel(ent, model[]) { if(get_pcvar_num(pnumplugin) == 0 || !is_valid_ent(ent)) return FMRES_IGNORED; if(!equali(model,"models/w_molotov.mdl")) return FMRES_IGNORED; new owner = entity_get_edict(ent,EV_ENT_owner); if(!g_hasMolotov[owner]) return FMRES_IGNORED; set_task(1.5,"grenade_explode",ent); return FMRES_IGNORED; }
public grenade_explode(ent) { if(get_pcvar_num(pnumplugin) == 0 || !is_valid_ent(ent)) return PLUGIN_CONTINUE; new Float:origin[3]; pev(ent,pev_origin,origin); message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(17); write_coord(floatround(origin[0])); // coord, coord, coord (position) write_coord(floatround(origin[1])); write_coord(floatround(origin[2])); write_short(firespr); // short (sprite index) write_byte(20); // byte (scale in 0.1's) write_byte(200); // byte (brightness) message_end(); molotov_damage(origin, "hegrenade", get_pcvar_float(pMldamage), get_pcvar_float(pMlradius)) return PLUGIN_CONTINUE; }
public molotov_damage(Float:origin[3], const classname[], Float:damage, Float:range) { new Float:pOrigin[3] new Float:dist new Float:tmpdmg for(new i = 1; i <= g_MaxPlayers; i++) { if(is_user_alive(i) ) { pev(i,pev_origin,pOrigin) dist = get_distance_f(origin,pOrigin) if(dist <= range) { tmpdmg = damage-(damage/range)*dist fm_fakedamage(i, classname, tmpdmg, DMG_BLAST) } } } }
What doesen't works:
1) If i use "say /molotov" the hegren will became molotov, but i want if i don't use "molotov" again to don't be molotov
2) Use used a condition to check if alearly have molotov, but i want to check if have alealy bought. So if have bought one and drop one, to can buy another
3) Molotov doesen't make fire effects on impact. It's like a HeGrenade.
Please fix that bugs. Thanks
|
|