Page 1 of 1

Kill player if he block transporter entity.

Posted: 03 Feb 2018, 20:21
by Obada
HI all, i hope you fine.

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"
}
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.
player killed self with tracktrain.
I tried to make one for me like this:

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
}
I know we can use this:

Code: Select all

user_kill(id)
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.

Re: Kill player if he block transporter entity.

Posted: 03 Feb 2018, 21:32
by Raheem

Re: Kill player if he block transporter entity.

Posted: 04 Feb 2018, 05:41
by Obada
LOL, That what i need exactly xD

Re: Kill player if he block transporter entity.

Posted: 04 Feb 2018, 11:47
by Raheem
NICE. Marked as solved.

Re: Kill player if he block transporter entity.

Posted: 21 Dec 2018, 15:45
by Muhammet20
Raheem wrote: 6 years ago NICE. Marked as solved.
raheem
man
help me please
i have problem when i compile the plugin
the problem is this

Error: Undefined symbol "Set_Rendering" on line 40
Error: Undefined symbol "PlaySound" on line 41

Re: Kill player if he block transporter entity.

Posted: 24 Dec 2018, 19:57
by karan
Muhammet20 wrote: 5 years ago
Raheem wrote: 6 years ago NICE. Marked as solved.
raheem
man
help me please
i have problem when i compile the plugin
the problem is this

Error: Undefined symbol "Set_Rendering" on line 40
Error: Undefined symbol "PlaySound" on line 41
use latest compiler

Re: Kill player if he block transporter entity.

Posted: 26 Dec 2018, 15:18
by Muhammet20
karan wrote: 5 years ago
Muhammet20 wrote: 5 years ago
Raheem wrote: 6 years ago NICE. Marked as solved.
raheem
man
help me please
i have problem when i compile the plugin
the problem is this

Error: Undefined symbol "Set_Rendering" on line 40
Error: Undefined symbol "PlaySound" on line 41
use latest compiler
no no the include file was have a false , i downloaded it again , its compile ing but the problem is , the plugin dont working in the game