Solved Kill player if he block transporter entity.

Coding Help/Re-API Supported
Post Reply
Obada
Member
Member
Palestine
Posts: 27
Joined: 6 years ago
Contact:

Kill player if he block transporter entity.

#1

Post by Obada » 6 years ago

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.


Obada
Member
Member
Palestine
Posts: 27
Joined: 6 years ago
Contact:

#3

Post by Obada » 6 years ago

LOL, That what i need exactly xD

User avatar
Raheem
Mod Developer
Mod Developer
Posts: 2214
Joined: 7 years ago
Contact:

#4

Post by Raheem » 6 years ago

NICE. Marked as solved.
He who fails to plan is planning to fail

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#5

Post by Muhammet20 » 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

karan
Mod Tester
Mod Tester
India
Posts: 122
Joined: 6 years ago
Location: India
Contact:

#6

Post by karan » 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
Image

Muhammet20
Veteran Member
Veteran Member
Posts: 408
Joined: 5 years ago
Contact:

#7

Post by Muhammet20 » 5 years ago

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

Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Who is online

Users browsing this forum: No registered users and 1 guest