Kill player if he block transporter entity.
Posted: 03 Feb 2018, 20:21
HI all, i hope you fine.
I seen this thread No Entities Block and i found those:
My question is how we can make the player who blocked those entities get killed / decrease his HP until he got killed by that entity? i mean make the entity is the killer.
I was seen before some server used that and when i blocked the transporter i got killed and this command appear on console.
I know we can use this:
But this like a slay command which i don't need to use.
My edited on code doesn't make the player killed actually, that command make his HP 0 and he still can make block for the entity until round end.
I seen this thread No Entities Block and i found those:
Code: Select all
new const szEntities[][] =
{
"func_train",
"func_vehicle",
"func_tracktrain",
"func_door"
}
I was seen before some server used that and when i blocked the transporter i got killed and this command appear on console.
I tried to make one for me like this:player killed self with tracktrain.
Code: Select all
#include <zombie_escape>
new not_allow
new const szEntities[][] =
{
"func_train",
"func_vehicle",
"func_tracktrain",
"func_door"
}
public plugin_precache()
{
precache_sound("zombie_escape/move.wav")
}
public plugin_init()
{
register_plugin("No Block", "1.0", "Raheem")
for (new i = 0; i < charsmax(szEntities); i++)
{
RegisterHam(Ham_Blocked, szEntities[i], "Fw_Blocked_Post", 1)
}
}
public Fw_Blocked_Post(iEnt, id)
{
if(!not_allow)
{
if (is_user_alive(id) && pev_valid(iEnt))
{
not_allow = true
Set_Rendering(id, kRenderFxGlowShell, random(256), random(256), random(256), kRenderNormal, 40)
PlaySound(id, "zombie_escape/move.wav")
if (!ze_is_user_zombie(id))
{
client_print(id, print_center, "You are blocking entity, MOVE! -10 H")
client_print(id, print_chat, "You are blocking entity, MOVE! -10 H")
new Float:pHealth = get_user_health(id) - 10.0
}
else
{
client_print(id, print_center, "You are blocking entity, MOVE! -1500 H")
client_print(id, print_chat, "You are blocking entity, MOVE! -1500 H")
new Float:pHealth = get_user_health(id) - 1500.0
set_entvar(id, var_health, pHealth)
}
set_task(2.00, "allow", id)
}
}
}
public allow(id)
{
not_allow = false
}
Code: Select all
user_kill(id)
My edited on code doesn't make the player killed actually, that command make his HP 0 and he still can make block for the entity until round end.