Raised This Month: $87 Target: $400
 21% 

Subplugin Submission [ZP] Extra Item: Golden Ak - 47 v1.1 Fix


Post New Thread Reply   
 
Thread Tools Display Modes
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-04-2009 , 19:20   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #11

alan_el_more, No. He is correct.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (intervening in a thread, asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 05-04-2009 , 19:31   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #12

Quote:
Originally Posted by YamiKaitou View Post
alan_el_more, No. He is correct.
why?
i read this tut: https://forums.alliedmods.net/showthread.php?t=91207
__________________
alan_el_more is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-04-2009 , 19:34   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #13

Actually you can do it but it should be : SetHamParamFloat(4, ( damage *= dmg ) )

but there is no need to update 'damage' since the new value will be passed using SetHamParamFloat. So, he's right to use directly damage* dmg.
Arkshine is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 05-04-2009 , 19:34   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #14

Because the *= operation is for assigning a value. Using the * operator is enough. Plus, I believe your method would pass true (or 1) to the function and not the actual value
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (intervening in a thread, asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-04-2009 , 19:35   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #15

Quote:
Originally Posted by alan_el_more View Post
Both work.

The difference is that yours make a redundant operation. It saves the value of the final damage in the variable damage
__________________
joaquimandrade is offline
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 05-04-2009 , 19:57   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #16

Can someone help me whit this?
Code:
L 05/04/2009 - 18:54:16: Invalid player id 0
L 05/04/2009 - 18:54:16: [AMXX] Displaying debug trace (plugin "zp_extra_goldenak.amxx")
L 05/04/2009 - 18:54:16: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 05/04/2009 - 18:54:16: [AMXX]    [0] zp_extra_goldena.sma::fw_TakeDamage (line
AlejandroSk is offline
Send a message via MSN to AlejandroSk
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-04-2009 , 20:06   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #17

The reason is the killer can be world ( 0 as id, eg: suicide ) or an entity > max_clients ; and you don't check it.

But, instead of get_user_weapon, you should read_data(1). ( like you can see here)
Arkshine is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 05-04-2009 , 20:06   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #18

Quote:
Originally Posted by AlejandroSk View Post
Can someone help me whit this?
Code:
L 05/04/2009 - 18:54:16: Invalid player id 0
L 05/04/2009 - 18:54:16: [AMXX] Displaying debug trace (plugin "zp_extra_goldenak.amxx")
L 05/04/2009 - 18:54:16: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 05/04/2009 - 18:54:16: [AMXX]    [0] zp_extra_goldena.sma::fw_TakeDamage (line
Check if the attacker is a player.

EDIT:
Oh, arkshine, you answered first.
__________________
IneedHelp is offline
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 05-04-2009 , 20:20   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #19

How can i check if the attacker is a player?
AlejandroSk is offline
Send a message via MSN to AlejandroSk
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 05-04-2009 , 20:23   Re: [ZP] Extra Item: Golden Ak - 47 v0.02
Reply With Quote #20

PHP Code:
#define is_valid_player(%1) (1 <= %1 <= 32)

if(is_valid_player[attacker]) 
__________________
alan_el_more 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 22:46.


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