| SweatyBanana |
12-12-2006 23:37 |
Problems making bomb transfer..
Well I am using part of VEN's plugin, but it wont transfer the bomb.
PHP Code:
#include <amxmodx> #include <amxmisc> #include <fun> #include <fakemeta>
#define FL_ONGROUND (1<<9)
new index,cvar1,cvar2,cvar3,cvar4,cvar5,cvar6; new Float:start, Float:end, Float:burytime; new origin[3];
public plugin_init() { register_plugin("Bomb Drop Slay","0.5","SweatyBanana");
register_dictionary("bombdict.txt")
// bomb status // 1 - plugin on // 0 - plugin off cvar1 = register_cvar("bomb_status","1"); cvar2 = register_cvar("bomb_time","10.0"); cvar3 = register_cvar("bomb_punish","1"); cvar4 = register_cvar("bomb_slaphealth","50"); cvar5 = register_cvar("bomb_burytime","10.0"); cvar6 = register_cvar("bomb_transfer","1");
if(engfunc(EngFunc_FindEntityByString, -1, "classname", "func_bomb_target") > 0) { register_logevent("f_spawned", 3, "2=Spawned_With_The_Bomb") register_logevent("f_dropped", 3, "2=Dropped_The_Bomb") } }
public f_spawned() { if(get_pcvar_num(cvar1)==0) return PLUGIN_HANDLED;
index = get_loguser_index(); start = get_gametime();
return PLUGIN_CONTINUE; }
public f_dropped() { new user = get_loguser_index(); if(get_pcvar_num(cvar1)==0 || !is_user_alive(user)) return PLUGIN_HANDLED;
end = get_gametime(); if(user==index && end-start<=get_pcvar_float(cvar2)) { f_punishuser(index); }
return PLUGIN_CONTINUE; }
public f_punishuser(index) { new punishment = get_pcvar_num(cvar3); new starthealth = get_user_health(index); new slaphealth = get_pcvar_num(cvar4); new transfer = get_pcvar_num(cvar6); burytime = get_pcvar_float(cvar5);
if(slaphealth<0 || burytime<0.0) { slaphealth = 50; burytime = 10.0; }
new Name[33]; get_user_name(index,Name,32); set_hudmessage(255, 0, 0, -1.0, 0.0, 0, 6.0, 12.0);
switch(punishment) { case 1: { user_kill(index,0); show_hudmessage(0,"%L",LANG_SERVER,"SLAY",Name); } case 2: { user_slap(index,slaphealth); show_hudmessage(0,"%L",LANG_SERVER,"SLAP",Name,starthealth-slaphealth); } case 3: { set_task(0.1,"f_bury",index); show_hudmessage(0,"%L",LANG_SERVER,"BURY",Name,floatround(burytime,floatround_floor)); } }
if(transfer == 1) { new user[32],num,x; get_players(user,num,"ae","TERRORIST")
get_user_origin(index,origin) new min_dist = 999999,dist,recipient,origin2[3]; for(new i = 0;i < num;++i) { x = user[i]
get_user_origin(x,origin2) dist = get_distance(origin,origin2) if(dist < min_dist) { min_dist = dist recipient = x } }
if(num<2) { return PLUGIN_HANDLED; }
new c4 = engfunc(EngFunc_FindEntityByString,-1,"classname","weapon_c4") // find weapon_c4 entity if(!c4) return PLUGIN_HANDLED;
new backpack = pev(c4,pev_owner) // get backpack entity if(backpack <= get_maxplayers()) return PLUGIN_HANDLED;
set_pev(backpack,pev_flags,pev(backpack,pev_flags)|FL_ONGROUND) dllfunc(DLLFunc_Touch,backpack,recipient) } return PLUGIN_HANDLED; }
public f_bury(index) { get_user_origin(index,origin); origin[2] -= 50; set_user_origin(index,origin); set_task(burytime,"f_unbury",index); }
public f_unbury(index) { get_user_origin(index,origin); origin[2] += 50; set_user_origin(index,origin); client_print(index,print_chat,"%L",LANG_SERVER,"UNBURY"); }
stock get_loguser_index() { new loguser[80],name[32]
read_logargv(0,loguser,79) parse_loguser(loguser,name,31)
return get_user_index(name) }
|