AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Best way to block vehicle kills (https://forums.alliedmods.net/showthread.php?t=245336)

Flick3rR 07-31-2014 13:11

Best way to block vehicle kills
 
Let's get on the topic - I'm trying to find the best way to block any kills with any kind of vehicle. Allright, I had some ideas (which may sound suuper srupid):
- registering message (get_user_smgid("DeathMsg")) and check if the weapon entity is "vehicle". Allright, but how to block (set_msg_block?). And also, how to prevent player from death - just continue pushing by the vehicle or just set his origin away from the vehicle ent?
- registering Ham_TakeDamage, where to check if inflictor is "vehicle" and then return the ham_supercede. But is this ham even called on vehicle kill?!


I'm still thinking that the first way is better, but have no clear idea how to fully block the killing and prevent player from dying... Thanks!

NikKOo31 07-31-2014 15:03

Re: Best way to block vehicle kills
 
Set godmode for a few seconds (?)

Flick3rR 07-31-2014 17:14

Re: Best way to block vehicle kills
 
Mmm, I don't know if it's the best way, since when he should die, something unknown will be done... Like flying the player away or stucking him somewhere, idk... Just guessing.
Waiting for some ideas, maybe...

NikKOo31 07-31-2014 17:39

Re: Best way to block vehicle kills
 
Quote:

Originally Posted by Flick3rR (Post 2176935)
Mmm, I don't know if it's the best way, since when he should die, something unknown will be done... Like flying the player away or stucking him somewhere, idk... Just guessing.
Waiting for some ideas, maybe...

Godmode + Noclip + Speed = 0 (?

I know, I'm a fucking genius (? :stupid:

klippy 07-31-2014 18:20

Re: Best way to block vehicle kills
 
I think you can loop through all "func_vehicle" entities and put their pev_dmg to 0, that should do it, no more drive-overs.

Flick3rR 07-31-2014 19:12

Re: Best way to block vehicle kills
 
Okay, but what's the best way to get entity's index from DeathMsg message? What does exactly read_data(4) or in this case get_msg_arg_string(4) return - is the string classname, or what, and how to get entity index from that string? FindEntityBy_ what?
Plus, where exactly to set pev_dmg to 0 to prevent making eny damage, do I have to do it directly in the message hook?
Thanks!

klippy 07-31-2014 20:32

Re: Best way to block vehicle kills
 
Just check for every "func_vehicle" in plugin_init() and set theirs pev_dmg to 0, that's all to it.

Flick3rR 07-31-2014 20:50

Re: Best way to block vehicle kills
 
Quote:

Originally Posted by KliPPy (Post 2177019)
Just check for every "func_vehicle" in plugin_init() and set theirs pev_dmg to 0, that's all to it.

Just like this? And that's all? :O :D
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("No Vehicle Kills""1.0""Flicker")
    
    new 
ent FM_NULLENT
    
    
    
while((ent engfunc(EngFunc_FindEntityByStringent"classname""func_vehicle")))
        
set_pev(entpev_dmg0)



klippy 07-31-2014 21:41

Re: Best way to block vehicle kills
 
Quote:

Originally Posted by Flick3rR (Post 2177025)
Just like this? And that's all? :O :D
PHP Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
    
register_plugin("No Vehicle Kills""1.0""Flicker")
    
    new 
ent FM_NULLENT
    
    
    
while((ent engfunc(EngFunc_FindEntityByStringent"classname""func_vehicle")))
        
set_pev(entpev_dmg0)



You should have tested it before posting here, but yes, that should be it, only if I haven't mistaken damage amount field, but since it says the key is "dmg" in VHE keyvalue, I guess it is pev_dmg indeed. I know for sure that pev_impulse is max speed(can be found in HLSDK).

Flick3rR 08-05-2014 16:48

Re: Best way to block vehicle kills
 
Well, will have to say that it doesn't work... :D It still kills the player.


All times are GMT -4. The time now is 13:46.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.