Raised This Month: $ Target: $400
 0% 

Fall damage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Gadzislaw007
Senior Member
Join Date: Nov 2009
Old 07-23-2010 , 19:43   Fall damage?
Reply With Quote #1

Well, Hi. Another problem here...

Code:
public Ham_Damage(id, inflictor, attacker, Float:damage, Damage)
{
	
	if(get_user_weapon(attacker) == CSW_KNIFE && zwiadowca[attacker] && cs_get_user_team(attacker) != cs_get_user_team(id))
	{
		user_kill(id)
		set_user_frags(attacker, get_user_frags(attacker)+1)
		
		
	}

	
}
Well it works well, but when I hurt myself by falling from high or something like that console says that id is invalid and it deos not hurt me... How to fix it?
Gadzislaw007 is offline
Gadzislaw007
Senior Member
Join Date: Nov 2009
Old 07-23-2010 , 19:59   Re: Fall damage?
Reply With Quote #2

Gosh, I'm so stupid .
Fixed, but if somebody has a problem like this here is the answer:


Code:
public Ham_Damage(id, inflictor, attacker, Float:damage, Damage)
{
	if(attacker != 0){
		if(get_user_weapon(attacker) == CSW_KNIFE && zwiadowca[attacker] && cs_get_user_team(attacker) != cs_get_user_team(id))
				{
				user_kill(id)
				set_user_frags(attacker, get_user_frags(attacker)+1)
		
		
				}
			}

}
Gadzislaw007 is offline
Old 07-24-2010, 00:57
PattyBiena
This message has been deleted by PattyBiena. Reason: sry
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2010 , 07:05   Re: Fall damage?
Reply With Quote #4

Quote:
Originally Posted by PattyBiena View Post
if (damage & DMG_FALL)
Do you ever read a thread before posting. Your little code snippet there has nothing to do with his problem.
__________________
Bugsy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-24-2010 , 09:18   Re: Fall damage?
Reply With Quote #5

And his problem is ? I don't get it, the title says "Fall damage ?" and the code checks for knife and team... WTF ?!

It's not even a good method, if player is killed by a grenade the hook will still continue if player has knife in his hand while the grenade explodes.

So, you might want to explain what you want to do, expecially if you have foreign language variable names (zwiadowca[attacker]).
__________________
Hunter-Digital is offline
Gadzislaw007
Senior Member
Join Date: Nov 2009
Old 07-24-2010 , 11:58   Re: Fall damage?
Reply With Quote #6

Well topic name isn't really bad, because it is basicaly about fall damage.

Quote:
Originally Posted by Hunter-Digital View Post
It's not even a good method, if player is killed by a grenade the hook will still continue if player has knife in his hand while the grenade explodes.
It is, because in this mod someone who has knife deosn't get a grenade .
Gadzislaw007 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2010 , 09:30   Re: Fall damage?
Reply With Quote #7

Quote:
Originally Posted by Gadzislaw007 View Post
Well it works well, but when I hurt myself by falling from high or something like that console says that id is invalid and it deos not hurt me... How to fix it?
He was getting an invalid player error because when fall damage occurs attacker = 0. So when get_user_weapon( attacker ) is called he would error. He selected a bad thread title.
__________________
Bugsy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 07-25-2010 , 09:38   Re: Fall damage?
Reply With Quote #8

No it's not, you should check inflictor if it's a player index, if it is then get the player's weapon... if not, then it's a nade, c4, map entity or map itself.

Just replace "attacker != 0" with "1 <= inflictor <= maxplayers" (maxplayers is the get_maxplayers() global var)
__________________
Hunter-Digital is offline
Gadzislaw007
Senior Member
Join Date: Nov 2009
Old 07-25-2010 , 09:54   Re: Fall damage?
Reply With Quote #9

There is no need for fixing the knife kill, because somebody who has knife can't actually have c4, granade and anything what allows you to change weapon before it damages.

But thanks for the second tip, I'll try it.
Gadzislaw007 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:14.


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