AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Head Shot Only (https://forums.alliedmods.net/showthread.php?t=83593)

Doc-Holiday 01-11-2009 23:34

Head Shot Only
 
To get head shots only could i do something like the following.

PHP Code:

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
 
new ison
public plugin_init() {
 
register_plugin("Head Shot Only""1.0""NcB_Sav")
 
ison register_cvar("hs_on""1")
 
RegisterHam(Ham_TraceAttack"player""ham_traceattack_player")
 
}

public 
ham_traceattack_player(iVictimiAttackerFloat:damageFloat:direction[3], traceresultdamagebits)
{
    if(
get_tr2(traceresultTR_iHitgroup) != HIT_HEAD || get_pcvar_num(ison))
    {
        
//set_tr2(traceresult, TR_iHitgroup, HIT_CHEST)
        
return HAM_HANDLED
    
}
    return 
HAM_IGNORED



BOYSplayCS 01-12-2009 00:12

Re: Head Shot Only
 
There are other ways without the hamsandwich module.

ConnorMcLeod 01-12-2009 00:19

Re: Head Shot Only
 
return HAM_SUPERCEDE

Doc-Holiday 01-12-2009 00:32

Re: Head Shot Only
 
Quote:

Originally Posted by ConnorMcLeod (Post 742573)
return HAM_SUPERCEDE

Thank you was looking for that

One last question. I have friendly fire on my server. so with ff on if i shoot my team mate will it ignore a body shot and only accept a head shot.

ConnorMcLeod 01-12-2009 00:33

Re: Head Shot Only
 
try

Doc-Holiday 01-12-2009 00:43

Re: Head Shot Only
 
Ok so its not allowing me to shoot at all. no damage to the person at all

ConnorMcLeod 01-12-2009 01:19

Re: Head Shot Only
 
if(get_tr2(traceresult, TR_iHitgroup) != HIT_HEAD || get_pcvar_num(ison))

Your statement is wrong.

Doc-Holiday 01-12-2009 04:06

Re: Head Shot Only
 
Quote:

Originally Posted by ConnorMcLeod (Post 742596)
if(get_tr2(traceresult, TR_iHitgroup) != HIT_HEAD || get_pcvar_num(ison))

Your statement is wrong.

How should it be then

ConnorMcLeod 01-12-2009 06:24

Re: Head Shot Only
 
it's logic

SnoW 01-12-2009 06:41

Re: Head Shot Only
 
Quote:

Originally Posted by ConnorMcLeod (Post 742583)
try

Quote:

Originally Posted by ConnorMcLeod (Post 742674)
it's logic

Pretty short answers :)

And back to the plugin:
Code:

if(get_tr2(traceresult, TR_iHitgroup) != HIT_HEAD || get_pcvar_num(ison))
So, what that means?
if(the guy didn't hit to head OR the cvar is 1)


All times are GMT -4. The time now is 01:45.

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