AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Mortal Headshot v0.1.1 (https://forums.alliedmods.net/showthread.php?t=163585)

eXtrem 07-31-2011 22:03

Mortal Headshot v0.1.1
 
1 Attachment(s)
Mortal Headshot
- v0.1.1


In case of headshot, you will kill in one shoot the enemy.
You can enable/disable this for each weapon.



| Command
  • mh_weapon < weapon shortname > < value > (ADMIN_KICK flag is needed)
weapon shortname : See list below
value : 0 is disabled ; 1 is enabled

Weapons short names are :
  • p228
  • scout
  • xm1014
  • mac10
  • aug
  • elite
  • fiveseven
  • ump45
  • sg550
  • galil
  • famas
  • usp
  • glock18
  • awp
  • mp5navy
  • m249
  • m3
  • m4a1
  • tmp
  • g3sg1
  • deagle
  • sg552
  • ak47
  • knife
  • p90


| Changelog
v0.1.1 - Cleaning all code
v0.0.1 - First Release


| Save Value
You want to save your settings ?
Put commands in ./amxmodx/amxx.cfg file

Examples :
* mh_weapon < weapon shortname > < value >

mh_weapon knife 1
mh_weapon glock 1
mh_weapon usp 0



Big thanks to Arkshine for helping me cleaning the code !


| Download

TGCorporation 08-01-2011 04:31

Re: Mortal Headshot v0.0.1
 
Cool plugin, in my server, all the people says: This server dont register?

Now i put this on my server. They dont say that anymore .

+k for you

eXtrem 08-01-2011 04:54

Re: Mortal Headshot v0.0.1
 
Thank you !

claudiuhks 08-01-2011 05:00

Re: Mortal Headshot v0.0.1
 
PHP Code:

public HamTraceAttackvictim attacker Float:damage Float:tr[3] , traceresult dmgbits )
{
    if( !
IsPlayerattacker ) || !IsPlayervictim ) || victim == attacker )
        return 
HAM_IGNORED

The victim is player always!

PHP Code:

    {
        
SetHamParamFloatdamage 9999.9 )
    } 

Try to put a fix damage value because if there's much than the 32 bits limit the bugs does appear...

eXtrem 08-01-2011 05:06

Re: Mortal Headshot v0.0.1
 
Quote:

Originally Posted by claudiuhks (Post 1523171)
PHP Code:

public HamTraceAttackvictim attacker Float:damage Float:tr[3] , traceresult dmgbits )
{
    if( !
IsPlayerattacker ) || !IsPlayervictim ) || victim == attacker )
        return 
HAM_IGNORED

The victim is player always!

What ? I check if the attacker is a player, if the victim is a player too, and if the attacker is not a victim too. What is the problem ?

Quote:

Originally Posted by claudiuhks (Post 1523171)
PHP Code:

    {
        
SetHamParamFloatdamage 9999.9 )
    } 

Try to put a fix damage value because if there's much than the 32 bits limit the bugs does appear...

Okay, fixed.

ConnorMcLeod 08-01-2011 05:12

Re: Mortal Headshot v0.0.1
 
PHP Code:

        if( equalszWeapon "weapon_smokegrenade" ) || equalszWeapon "weapon_flashbang" ) || equalszWeapon "weapon_hegrenade" ) , equalszWeapon "weapon_c4" ) )
        {
            return 
PLUGIN_HANDLED
        


This is useless, if you really want to check, then check weaponid it is faster.
No check result in the array to be filled, it's not really a problem.


For victim check, you register the ham forward with classname "player", so victim can't be any other entity than a player, that's why the check is useless.

Arkshine 08-01-2011 05:14

Re: Mortal Headshot v0.0.1
 
Quote:

What ? I check if the attacker is a player, if the victim is a player too, and if the attacker is not a victim too. What is the problem ?
He says just the check if victim is a player or not is pointless since your register the forward with "player" and the victim can be only a player anyway.

eXtrem 08-01-2011 05:18

Re: Mortal Headshot v0.0.1
 
Quote:

Originally Posted by ConnorMcLeod (Post 1523178)
PHP Code:

        if( equalszWeapon "weapon_smokegrenade" ) || equalszWeapon "weapon_flashbang" ) || equalszWeapon "weapon_hegrenade" ) , equalszWeapon "weapon_c4" ) )
        {
            return 
PLUGIN_HANDLED
        


This is useless, if you really want to check, then check weaponid it is faster.
No check result in the array to be filled, it's not really a problem.


For victim check, you register the ham forward with classname "player", so victim can't be any other entity than a player, that's why the check is useless.

Ok, fixed. I have checked with weaponid.

Quote:

Originally Posted by Arkshine (Post 1523181)
He says just the check if victim is a player or not is pointless since your register the forward with "player" and the victim can be only a player anyway.

I didn't understand that, sorry. :3

bibu 08-01-2011 05:27

Re: Mortal Headshot v0.0.1
 
PHP Code:

if( !IsPlayerattacker ) || !IsPlayervictim ) || victim == attacker 

->

PHP Code:

if( !IsPlayerattacker ) || victim == attacker 

I am not sure, but don't you need to check if attacker is connected?

eXtrem 08-01-2011 05:29

Re: Mortal Headshot v0.0.1
 
Quote:

Originally Posted by bibu (Post 1523192)
PHP Code:

if( !IsPlayerattacker ) || !IsPlayervictim ) || victim == attacker 

->

PHP Code:

if( !IsPlayerattacker ) || victim == attacker 


Already done, refresh, I didn't update the sma. :mrgreen:
Quote:

Originally Posted by bibu (Post 1523192)
I am not sure, but don't you need to check if attacker is connected?

If the attacker is a player, he is connected. :3


All times are GMT -4. The time now is 10:27.

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