Raised This Month: $ Target: $400
 0% 

If entity touches player...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rixorster
Senior Member
Join Date: Jul 2005
Old 03-15-2006 , 09:59   If entity touches player...
Reply With Quote #1

then he loses hp? How can i do like that, if my ent's name is Ent, and when Ent touches player, the player it touched loses hp?
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-15-2006 , 10:06  
Reply With Quote #2

In plugin_init:
Code:
register_touch("Ent" , "player" , "touched_player");

Then:
Code:
public touched_player(ptr , ptd) {   if(is_user_connected(ptd) && is_user_alive(ptd)) {     set_user_health(ptd , get_user_health(ptd) - 5);   } }
;)
__________________
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
ChanT
Junior Member
Join Date: Mar 2006
Old 03-16-2006 , 15:50  
Reply With Quote #3

for what stands the ptr and ptd?
and how can i add more then 1 ent.. so like 3 entities?
ChanT is offline
Rixorster
Senior Member
Join Date: Jul 2005
Old 03-16-2006 , 15:54  
Reply With Quote #4

ptr= pToucher(this is the toucher)
ptd= pTouched(one that is touched)
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-16-2006 , 16:17  
Reply With Quote #5

The touched will always be a player.
__________________
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
Rixorster
Senior Member
Join Date: Jul 2005
Old 03-17-2006 , 01:52  
Reply With Quote #6

Hmm, just an question, how can i check if its an entity?
Btw, thanks v3x ;D
__________________
You never know, what will happen the day after tomorrow...

+karma if i helped you!
Rixorster is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 03-17-2006 , 01:58  
Reply With Quote #7

Code:
bool:is_entity( EntityID ) {       if( is_valid_ent( EntityID ) && EntityID > get_maxplayers() )              return true;       return false; }

this should work for you
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
VEN
Veteran Member
Join Date: Jan 2005
Old 03-17-2006 , 02:52  
Reply With Quote #8

Player has entity either.

Quote:
The touched will always be a player
Not always.
VEN is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 03-17-2006 , 04:56  
Reply With Quote #9

Yes, always. The touched MUST be a player, unless the transaction does not have a player in it.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
VEN
Veteran Member
Join Date: Jan 2005
Old 03-17-2006 , 05:31  
Reply With Quote #10

I mean in fact player can be toucher or touched.
But for register_touch("Ent" , "player" , "touched_player") touched would be the player since it filter out other classnames.
VEN 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:25.


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