Raised This Month: $ Target: $400
 0% 

Get user attack


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NeverDie
Junior Member
Join Date: Mar 2006
Old 03-01-2006 , 12:38   Get user attack
Reply With Quote #1

Hi i was wonding how i can get a user attacker and make it so if a user is attacked with anything but a knife it will force them to drop a weapon i been trying to use something like
Code:
register_event("Damage", "checkDamage", "b", "2!0")

public checkDamage(id)
{
	new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
	
	if ( attacker <= 0 ) 
	{
		return
	}	
	else if ( weapon == CSW_KNIFE )
	{
		return
	}
	else
	{
		client_cmd(attacker, "drop")
	}
	
	return
}
But this seems not to work because when you fall of something it makes the victim still drop his weapon and when u att some1 it makes them drop there weapon.
NeverDie is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-01-2006 , 12:42  
Reply With Quote #2

Code:
register_event("Damage", "checkDamage", "b", "2!0") public checkDamage(id) {    new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)    if(!is_user_alive(attacker) || attacker == id)       return PLUGIN_CONTINUE    if(weapon != CSW_KNIFE)       client_cmd(attacker, "drop")    return PLUGIN_CONTINUE }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
NeverDie
Junior Member
Join Date: Mar 2006
Old 03-01-2006 , 12:52  
Reply With Quote #3

Thx, but if i fall of something it still makes me drop my own weapon.
NeverDie is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-01-2006 , 12:55  
Reply With Quote #4

Try the edited version.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
NeverDie
Junior Member
Join Date: Mar 2006
Old 03-01-2006 , 12:58  
Reply With Quote #5

Thanks now it doesnt make me drop my weapon just need to get some1 on my server now to see if works.
NeverDie is offline
NeverDie
Junior Member
Join Date: Mar 2006
Old 03-01-2006 , 13:06  
Reply With Quote #6

Is there anyway i can make it so it checks every few seconds for a few seconds if your being attacked rather then always? i have been lookin at somethin like set_task(1.0,"checkDamage",0,"",0,"b" ) but i not sure how it would be used?
NeverDie is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-01-2006 , 13:16  
Reply With Quote #7

Yes.

Code:
public client_putinserver(id) {   set_task(1.0, "checkDamage", id, _, _, "b") } public checkDamage(id) {   if(!is_user_connected(id) || !is_user_alive(id))     return;   // stuff }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
NeverDie
Junior Member
Join Date: Mar 2006
Old 03-01-2006 , 13:18  
Reply With Quote #8

But how can u make it loop for a few seconds then stop for few etc?
NeverDie 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 20:23.


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