Raised This Month: $ Target: $400
 0% 

displaying who did the damage!? [SOLVED]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gzus
Member
Join Date: Jan 2007
Old 02-20-2007 , 19:17   displaying who did the damage!? [SOLVED]
Reply With Quote #1

PHP Code:
public MHO_Damage(id)
 {
 new 
damage read_data(2)
 
//new attacker = read_data(1)
 
new szName[32]     get_user_name(idszName31)
 new 
P_A_Name get_user_attacker(id)
 
//get_user_name(idInflictor, P_A_Name[idInflictor], 31)
 
server_print("--MHO MOD-- [DAMAGE] %s took: %i from: %s"szNamedamageP_A_Name)     //PlayerXP[idInflictor] += damage     //ShowHUD(attacker)
 

using this, in the console i get the name of my server as the attacker, any idea what i did wrong?
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com

Last edited by gzus; 02-20-2007 at 20:49. Reason: solved
gzus is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-20-2007 , 19:41   Re: displaying who did the damage!?
Reply With Quote #2

It means that "id" is 0.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
gzus
Member
Join Date: Jan 2007
Old 02-20-2007 , 20:34   Re: displaying who did the damage!?
Reply With Quote #3

ok i get it now, i got a lil post happy and jumpped the gun.. i ended up havin to do a bunch of error handling for it..

i ended up with this:
Code:
public MHO_Damage(id)     {     new damage = read_data(2)     //new attacker = read_data(1)     new szName[32], szAtt[32]     get_user_name(id, szName, 31)     new P_A = get_user_attacker(id)     get_user_name(P_A, szAtt, 31)     //get_user_name(idInflictor, P_A_Name[idInflictor], 31)     //server_print("--MHO MOD-- [DAMAGE] - %s took: %i from: %s", szName, damage, szAtt)     if (P_A >= 32){     server_print("--MHO MOD-- [DAMAGE] - NONE Player Attacker")     } else {         if (P_A == 0){             server_print("--MHO MOD-- [DAMAGE] - NONE Player Attacker")         } else {             PlayerXP[P_A] += damage             server_print("--MHO MOD-- [DAMAGE] - Player Attacker: %s", szAtt)             if(is_user_bot(id) == 1){             } else {                 if(is_user_alive(id)){                     ShowHUD(P_A)                 }             }         }     }     //ShowHUD(attacker) }


its still throwin me a few index out of bounds in the showhud here n there, but im workin the bugs out, well trying to.

any advice on the out of bounds debugging? all was fine and dandy till i added this in there, now its spittin those index errors at me. i understand that usually it means that im tryin to display a hud to an index of something above 32 or 33, but it doesnt seem like any thing higher than 32 will get passed me here.. atleast id think i handled it all.


//------------------------------------------
edited:

i never hand error handling in the ShowHUD, i needed checks for if user is alive, and all that, with that in there, it solved the index out of bounds issues.
__________________
71.200.20.142:27017 - testing mho mod
if you need any files visit clan.mosthatedonline.com

Last edited by gzus; 02-20-2007 at 20:52.
gzus is offline
Reply



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 00:37.


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