• Print

Author Topic: Can't get damage returning to work...  (Read 6321 times)

0 Members and 1 Guest are viewing this topic.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Can't get damage returning to work...
« on: February 27, 2014, 03:59:12 pm »
http://pastebin.com/QDTRwzJP

For some reason I can't get my code to return the damage caused by the prop to the props owner... Any suggestions would help me out a ton.
Sorry but my debugging is still in there... :P
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Can't get damage returning to work...
« Reply #1 on: February 27, 2014, 04:05:09 pm »
I'm smart but also somewhat lazy - which line has the hook you're troubleshooting, I'll find the function from there.
(Don't feel like looking over all the code to find it dmg hooks)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Can't get damage returning to work...
« Reply #2 on: February 27, 2014, 04:11:33 pm »
I'm smart but also somewhat lazy - which line has the hook you're troubleshooting, I'll find the function from there.
(Don't feel like looking over all the code to find it dmg hooks)

Line 242. The function spans from line 189 - 241.

Here is some debug info of me hitting a person with a prop...

Code: Text
  1. ServerLog: Ayumi (STEAM_0:1:68223774) Spawned a models/props_c17/oildrum001.mdl
  2.  
  3.  | Bad, Good: true, false |
  4.  1. | Damage: 0 Attacker: Entity [86][prop_physics] |
  5.  2. | Damage: 0 Attacker: Entity [86][prop_physics] |
  6.  3. | Damage: 0 Attacker: Entity [86][prop_physics] |
  7. DEBUG: A:       Entity [86][prop_physics]        I:     Entity [86][prop_physics]        D:     0
  8.  4. | Damage: 0 Attacker: Entity [86][prop_physics] |
  9. Ayumi[STEAM_0:1:68223774] hit \;[STEAM_0:0:20479184] with a prop! -- I asked my friend to make his name \; to test against "bad" names.
  10.  5. | Damage: 0 Attacker: Player [1][Ayumi] |
  11. MUCH WOW: Player [1][Ayumi] | Hurting with 0 damage. <----- This is the part that is supposed to hurt me but for some reason it does 0 damage...
  12.  | Bad, Good: false, false |
  13.  1. | Damage: 0 Attacker: Player [1][Ayumi] |
  14.  2. | Damage: 0 Attacker: Player [1][Ayumi] |
  15.  3. | Damage: 0 Attacker: Player [1][Ayumi] |
  16.  | Bad, Good: false, false |
  17.  1. | Damage: 5 Attacker: Player [2][goo] |
  18.  2. | Damage: 5 Attacker: Player [2][goo] |
  19.  3. | Damage: 5 Attacker: Player [2][goo] |
  20.  | Bad, Good: false, false |
  21.  1. | Damage: 0 Attacker: Player [2][goo] |
  22.  2. | Damage: 0 Attacker: Player [2][goo] |
  23.  3. | Damage: 0 Attacker: Player [2][goo] |
  24. DEBUG: A:       Player [2][goo]  I:     Player [2][goo]  D:     0
  25.  4. | Damage: 0 Attacker: Player [2][goo] |
  26.  | Bad, Good: false, false |
  27.  1. | Damage: 5 Attacker: Player [2][goo] |
  28.  2. | Damage: 5 Attacker: Player [2][goo] |
  29.  3. | Damage: 5 Attacker: Player [2][goo] |
  30.  | Bad, Good: false, false |
  31.  1. | Damage: 0 Attacker: Player [2][goo] |
  32.  2. | Damage: 0 Attacker: Player [2][goo] |
  33.  3. | Damage: 0 Attacker: Player [2][goo] |
  34. DEBUG: A:       Player [2][goo]  I:     Player [2][goo]  D:     0
  35.  4. | Damage: 0 Attacker: Player [2][goo] |
  36.  | Bad, Good: true, false |
  37.  1. | Damage: 0 Attacker: Entity [86][prop_physics] |
  38.  2. | Damage: 0 Attacker: Entity [86][prop_physics] |
  39.  3. | Damage: 0 Attacker: Entity [86][prop_physics] |
  40. DEBUG: A:       Entity [86][prop_physics]        I:     Entity [86][prop_physics]        D:     0
  41.  4. | Damage: 0 Attacker: Entity [86][prop_physics] |
  42.  5. | Damage: 0 Attacker: Player [1][Ayumi] |
  43. MUCH WOW: Player [1][Ayumi] | Hurting with 0 damage. <----- This is the part that is supposed to hurt me but for some reason it does 0 damage...
  44.  | Bad, Good: false, false |
  45.  1. | Damage: 0 Attacker: Player [1][Ayumi] |
  46.  2. | Damage: 0 Attacker: Player [1][Ayumi] |
  47.  3. | Damage: 0 Attacker: Player [1][Ayumi] |
  48. ServerLog: prop_physics(models/props_c17/oildrum001.mdl) Got removed
  49.  
« Last Edit: February 27, 2014, 04:18:44 pm by LuaTenshi »
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Can't get damage returning to work...
« Reply #3 on: February 27, 2014, 07:20:15 pm »
It's late, I'm tired, so unfortunately won't be able to review closely tonight.
However, until next time, make sure you don't have any of your other code prevent damage to group access you're in.
Related to code/protection, the prop friend is using to test, did they spawn, or did you? Tried with either?
Make sure god mode, ulx or otherwise, isn't affecting you individually.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Can't get damage returning to work...
« Reply #4 on: February 27, 2014, 07:27:41 pm »
It's late, I'm tired, so unfortunately won't be able to review closely tonight.
However, until next time, make sure you don't have any of your other code prevent damage to group access you're in.
Related to code/protection, the prop friend is using to test, did they spawn, or did you? Tried with either?
Make sure god mode, ulx or otherwise, isn't affecting you individually.

I was the one throwing the prop.

I was admin but was not in godmode or any thing plus ULX was not running at the time. I probably need to clear the server of every thing and test with just my addon and see what happens.
« Last Edit: February 27, 2014, 07:29:18 pm by LuaTenshi »
I cry every time I see that I am not a respected member of this community.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Can't get damage returning to work...
« Reply #5 on: February 27, 2014, 07:49:00 pm »
Unless the prop was launched with the gravity gun, there is no way to get the player that "threw" it.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Can't get damage returning to work...
« Reply #6 on: February 27, 2014, 10:24:55 pm »
Unless the prop was launched with the gravity gun, there is no way to get the player that "threw" it.

Yeah but getting the owner of the prop is the next best thing and that is what I am doing, I know that this can be problematic but I provide the option to turn it off so...
But yeah I can't get it to deal damage to the owner of the prop when that prop hits a player, for some reason it always comes back as 0.
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Can't get damage returning to work...
« Reply #7 on: February 28, 2014, 09:44:08 pm »
Line 196 - You define 4 variables with only 3 functions. You never assign 'odmg' variable anywhere that I can find.
So, it comes back (nil or 0?) when you attempt to use it in lines 234 and 235?
Plus what MrP says?
(Please forgive me if I'm no where close...it's truly been many years since I've coded Glua directly)
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Can't get damage returning to work...
« Reply #8 on: March 01, 2014, 12:21:38 am »
I looked at your pastebin and debug output and I agree with what JamminR says. You are trying to use odmg without properly defining it. It will always return 0 or nil.

  • Print