Raised This Month: $12 Target: $400
 3% 

Mortal Headshot v0.1.1


Post New Thread Reply   
 
Thread Tools Display Modes
bibu
Veteran Member
Join Date: Sep 2010
Old 08-01-2011 , 06:16   Re: Mortal Headshot v0.0.1
Reply With Quote #11

Right yes.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 08-01-2011 , 09:28   Re: Mortal Headshot v0.0.1
Reply With Quote #12

I suggest you to make a configuration file where to set the weapons...

Example:

PHP Code:
SG-552 Commando
sg552

AK-47 Kalashnikov
ak47

IMI Galil
galil

Schmidt Scout
scout 
The weapon names are:

Code:
// Thanks Mercylezz

P228 Compact
Schmidt Scout
XM1014 M4
Ingram MAC-10
Steyr AUG A1
Dual Elite Berettas
FiveseveN
UMP 45
SG-550 Auto-Sniper
IMI Galil
Famas
USP .45 ACP Tactical
Glock 18C
AWP Magnum Sniper
MP5 Navy
M249 Para Machinegun
M3 Super 90
M4A1 Carbine
Schmidt TMP
G3SG1 Auto-Sniper
Desert Eagle .50 AE
SG-552 Commando
AK-47 Kalashnikov
ES P90
__________________

Last edited by claudiuhks; 08-01-2011 at 09:33.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
eXtrem
Member
Join Date: Jul 2011
Old 08-01-2011 , 10:01   Re: Mortal Headshot v0.0.1
Reply With Quote #13

Quote:
Originally Posted by claudiuhks View Post
I suggest you to make a configuration file where to set the weapons...

Example:

PHP Code:
SG-552 Commando
sg552

AK-47 Kalashnikov
ak47

IMI Galil
galil

Schmidt Scout
scout 
The weapon names are:

Code:
// Thanks Mercylezz

P228 Compact
Schmidt Scout
XM1014 M4
Ingram MAC-10
Steyr AUG A1
Dual Elite Berettas
FiveseveN
UMP 45
SG-550 Auto-Sniper
IMI Galil
Famas
USP .45 ACP Tactical
Glock 18C
AWP Magnum Sniper
MP5 Navy
M249 Para Machinegun
M3 Super 90
M4A1 Carbine
Schmidt TMP
G3SG1 Auto-Sniper
Desert Eagle .50 AE
SG-552 Commando
AK-47 Kalashnikov
ES P90
Okay, I will see what is better.
eXtrem is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-04-2011 , 13:03   Re: Mortal Headshot v0.0.1
Reply With Quote #14

  • In HamTraceAttack() :
    • Put g_weaponMortalHeadshot check before get_tr2. When you can, always check first the variables to filter more and avoid to call natives. The less natives you call, the more efficient your plugin will be.
    • You could use directly get_user_weapon in the array. The code is readable and you avoid to create a var.
    • I would avoid to alter the damage done, because it influences on the blood quantity, punch angle and such, when the purpose of the plugin is to simply kill right away with the current damage. Also, you do * 100, but it may not enough. So, you would better to avoid to alter damage and instead put the player's health to 0. It should be enough and you can be sure it will be killed. Please test before though.
  • In ConsoleCommand_MortalHeadshot()
    • Is there a specific reason you don't use cmd_access ? If not, you better use it, it will throw a message if you don't have the level required.
    • Retrieve the second argument only if the weapon id is valid.
    • I see you do several checks to filter CSW* constants. Here a tip to make your code shorter and with one check. Of course use your own style.
      Code:
      const bitsNotWeapons = 1 << CSW_SMOKEGRENADE | 1 << CSW_HEGRENADE | 1 << CSW_FLASHBANG | 1 << CSW_C4; if( weaponid && ~( 1 << weaponid ) & bitsNotWeapons ) {
    • Don't use client_print. Use instead console_print. It's a console command and message will be printed properly whatever you use from the server console or client.
    • Your forget to return PLUGIN_HANDLED, otherwise you will get a message the command is unknown.
__________________

Last edited by Arkshine; 01-13-2012 at 16:02.
Arkshine is offline
eXtrem
Member
Join Date: Jul 2011
Old 01-13-2012 , 17:17   Re: Mortal Headshot v0.0.1
Reply With Quote #15

I've clean the code.

By the way : if I set the health to 0 in HamTraceAttack(), the model is bugged, and we can walk through the player, so I set it to 1 and it works.

Last edited by eXtrem; 01-13-2012 at 17:18.
eXtrem is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2012 , 04:31   Re: Mortal Headshot v0.1.1
Reply With Quote #16

You forget == HIT_HEAD
__________________
Arkshine is offline
eXtrem
Member
Join Date: Jul 2011
Old 01-14-2012 , 05:40   Re: Mortal Headshot v0.1.1
Reply With Quote #17

Right, fixed. Thanks.
eXtrem is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2012 , 05:41   Re: Mortal Headshot v0.1.1
Reply With Quote #18

Wrong modification.
__________________
Arkshine is offline
Old 01-14-2012, 11:24
Devil259
This message has been deleted by Devil259.
eXtrem
Member
Join Date: Jul 2011
Old 01-15-2012 , 06:44   Re: Mortal Headshot v0.1.1
Reply With Quote #19

Which modification ?

I added == HIT_HEAD to the get_tr2 check.
eXtrem is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-15-2012 , 06:48   Re: Mortal Headshot v0.1.1
Reply With Quote #20

Seriously, compile/test before uploading something.

get_tr2( traceresult , TR_iHitgroup == HIT_HEAD )

You see nothing wrong ?
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:37.


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