kill soemone in entitie

someone got script to kill soemone in a entities because we got cars on our server but if u shoot he doesnt die.
thnx.

[lua]player:Kill()[/lua]

but then u die.
i want that u take damage

You could try experimenting with Gamemode.EntityTakeDamage and having the passenger of the vehicle take the same damage from the same attacker.

This is untested and I can’t guarantee it would work :



function CarDamage( ent, inflictor, attacker, amount, dmginfo )
 
	if ( ent:IsVehicle() and ent:GetDriver() ) then

		ent:GetDriver():TakeDamageInfo( dmginfo ) 

	end
 
end
hook.Add( "EntityTakeDamage", "CarDamage", CarDamage )


thnx i tested script but its still not working.

Any errors, or just nothing? You’re going to need to be more descriptive to get adequate help.

No errors. It is still the same as it was, when you shoot at the car, you don’t loose health

Hey, you remember the last three times you asked me this on steam, and how every time I told you to manually set the player’s health?
Did you ignore that?
Well clearly you did.
In fact, you never seemed to see any of my messages, other than the ones relating to money.

I use to act like that, when i had you on steam. Lol.

Nobody on facepunch adds me on steam :frowning: Except FlapJack. Pffft.

I’ll add you. wargamerz@yahoo.com is my steam account name. (NOT MY FECKIN EMAIL.)
add me if you want.

I would add you if I knew your steam.

Stay on topic, please

You’re saying it should be this?


function CarDamage( ent, inflictor, attacker, amount, dmginfo )

	if ( ent:IsVehicle() and ent:GetDriver() ) then

		ply = ent:GetDriver()
		ply:SetHealth( ply:Health() - amount ) 

	end
 
end
hook.Add( "EntityTakeDamage", "CarDamage", CarDamage )

I guess that means the engine prevents the player from taking damage in the vehicle… Too bad kill credit is gone that way. How about this? (can’t test here)



 
function playershouldtakedamage(victim, attacker)

	if victim:InVehicle() then return true end

hook.Add( "PlayerShouldTakeDamage", "playershouldtakedamage", playershouldtakedamage)


@ geniouszx3 /

No it’s not. :v: Google tells me it’s STEAM_1:0:24293142

my steam ID is :m4st3rb0yx

[editline]02:24PM[/editline]

it doesn’t work.

i added u.