Damage problem
Hi, here I am again.
I really didn't think I would have any other problem, but I didn't expect to have a problem with something stupid I can't resolve: (This whole code is in ham_takedamage PRE) PHP Code:
|
Re: Damage problem
Do you have a weapon or a player class? I do not get the part farpiece[attacker] which indicates that you check against player flag "farpiece". What is the problem to have 2 damage multipliers for normal weapon and "farpiece"?
|
Re: Damage problem
Yeah I should have said the code contains like another 7 special guns, so it would be hard to divide, and also the takedamage register has player class. the farpiece[attacker] is just a variable checking if the player has bought the gun. Trust me I was thinking about dividing the guns into special and normal ones, but for example, if a player has a melee special (like chainsaw), then the "else" wouldn't be called and so the casual guns like M4A1 or AK47 wouldn't deal the increased damage, which I need. Maybe there's a way to do it, but I was trying to do it for HOURS, ran out of ideas and it was no success at all. I'm just asking if there ain't some easier and not time-taking solution to make it work.
|
Re: Damage problem
First of all, I have to say I am noob in amx scripting). I started just a few days ago. I never created neither special weapon nor "takedamage register with player class". I would register client_damage event and check for the wpnindex. For example, we have CSW_KNIFE damage. If a player reaches level 1, increase damage. If a player hold special version, increase damage. See no problem with it. If you are bothered about copying similar code sections, just create an array of relations normal weapon -> special one and loop through it. If this is not the case, then I need to see the full code.
|
Re: Damage problem
Say "damage" is the name of the 4th argument in your Ham_TakeDamage function, when you call SetHamParamFloat(4, somerandomvalue), the "damage" argument remains the same, it's only changed for the next calls of the function. So what you are doing is this.
Original "damage" is 25. You deal damage with farpiece, so you SetHamParamFloat(4, 500), expecting the damage to become 500. You are higher than level 1, so you are using SetHamParamFloat(4, damage*leveldamage) to further boost your intended damage, however "damage" is still at 25, not 500, so farpiece damage is ignored. A fix for this is to assign the "damage" variable to the same value you intend it to be after using SetHamParamFloat, so instead of typing PHP Code:
PHP Code:
PHP Code:
|
Re: Damage problem
Nice, it finally works well! Thank you both for help! (How could I have not realized to just edit the Float:damage bruh.. :D)
|
| All times are GMT -4. The time now is 15:36. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.