|
Senior Member
|

06-19-2014
, 05:21
Specific player can touch only specific entity
|
#1
|
I have this plugin
PHP Code:
/* Name: [ZP] Addon: Bonus Box Author: PomanoB & STRELOK Version 1.0
Based on [ZP] DM Item's by PomanoB */ #include <superheromod> #include <amxmodx> #include <amxmisc> #include <fakemeta> #include <fakemeta_util> #include <hamsandwich>
#define PLUGIN "[ZP] Addon: Bonus Box" #define VERSION "1.0" #define AUTHOR "PomanoB & Accelerator"
new const item_class_name[] = "dm_item"
new g_models[][] = {"models/shero/presents.mdl"}
public plugin_precache() { for (new i = 0; i < sizeof g_models; i++) precache_model(g_models[i]) }
public round_start() { new ent = FM_NULLENT static string_class[] = "classname" while ((ent = engfunc(EngFunc_FindEntityByString, ent, string_class, item_class_name))) set_pev(ent, pev_flags, FL_KILLME) }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) register_forward(FM_Touch, "fwd_Touch") register_event("HLTV", "round_start", "a", "1=0", "2=0") RegisterHam(Ham_Killed, "player", "fw_PlayerKilled") register_dictionary("bonus_box.txt") }
public show_hud() { new Player[32], playerCount get_players(Player, playerCount, "c") set_hudmessage(225, 0, 0, 0.99, 0.15, clamp(1, 0, 2), 6.0, 1800.0, 6.0, 6.0, -1) for(new id=1; id <= playerCount; id++) { if(!is_user_alive(Player[id])) ShowSyncHudMsg(Player[id], CreateHudSyncObj(), "Bonus boxes event!") } }
public fwd_Touch(toucher, touched) { if (!is_user_alive(toucher) || !pev_valid(touched)) return FMRES_IGNORED new classname[32] pev(touched, pev_classname, classname, 31) if (!equal(classname, item_class_name)) return FMRES_IGNORED shgive_item(toucher) set_pev(touched, pev_effects, EF_NODRAW) set_pev(touched, pev_solid, SOLID_NOT) return FMRES_IGNORED }
public fw_PlayerKilled(victim, attacker, shouldgib) { if (!is_user_connected(attacker) || !is_user_connected(victim) || attacker == victim || !attacker) return HAM_IGNORED new random = random_num(0, 9) new hour[3] get_time("%H", hour, 2) if(str_to_num(hour) == 20) { if (random <= 5) { new origin[3] get_user_origin(victim, origin, 0) addItem(origin) if(!task_exists(2212)) set_task(1.0, "show_hud", 2212, _, _, "b") } } else if(random == 5) { new origin[3] get_user_origin(victim, origin, 0) addItem(origin) if(task_exists(2212)) remove_task(2212) } return HAM_IGNORED }
public removeEntity(ent) { if (pev_valid(ent)) engfunc(EngFunc_RemoveEntity, ent) }
public addItem(origin[3]) { new ent = fm_create_entity("info_target") set_pev(ent, pev_classname, item_class_name) engfunc(EngFunc_SetModel,ent, g_models[random_num(0, sizeof g_models - 1)])
set_pev(ent,pev_mins,Float:{-10.0,-10.0,0.0}) set_pev(ent,pev_maxs,Float:{10.0,10.0,25.0}) set_pev(ent,pev_size,Float:{-10.0,-10.0,0.0,10.0,10.0,25.0}) engfunc(EngFunc_SetSize,ent,Float:{-10.0,-10.0,0.0},Float:{10.0,10.0,25.0})
set_pev(ent,pev_solid,SOLID_BBOX) set_pev(ent,pev_movetype,MOVETYPE_FLY) new Float:fOrigin[3] IVecFVec(origin, fOrigin) set_pev(ent, pev_origin, fOrigin) set_pev(ent,pev_renderfx,kRenderFxGlowShell) switch(random_num(1,4)) { case 1: set_pev(ent,pev_rendercolor,Float:{0.0,0.0,255.0}) case 2: set_pev(ent,pev_rendercolor,Float:{0.0,255.0,0.0}) case 3: set_pev(ent,pev_rendercolor,Float:{255.0,0.0,0.0}) case 4: set_pev(ent,pev_rendercolor,Float:{255.0,255.0,255.0}) } }
When somebody dies a box is let behind and if someone touch it will receive something. It want to change this plugin... only the player who killed the victim can touch the box left by victim and receive the bonus, or at least the toucher id team != victim id team
I know that function shgive_item is missing, there is nothing that I could change to make this plugin as I want.
|
|