Raised This Month: $ Target: $400
 0% 

Using pfn_touch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cronck
Member
Join Date: Apr 2005
Old 04-25-2005 , 04:53   Using pfn_touch
Reply With Quote #1

Is it possible to use this to check if to players is tuching eachother?
And how do i use it?
Cronck is offline
More
Member
Join Date: Nov 2004
Location: Internet
Old 04-25-2005 , 09:00  
Reply With Quote #2

Code:
public pfn_touch (ptr, ptd) {   if ((ptr > 0) && (ptd > 0) && is_valid_ent(ptr) && is_valid_ent(ptd)) {     new classname_ptr[32], classname_ptd[32]     entity_get_string(ptr, EV_SZ_classname, classname_ptr, 31)     entity_get_string(ptd, EV_SZ_classname, classname_ptd, 31)     if (equal(classname_ptr, "player") && equal(classname_ptd, "player")) {       new name_ptr[32], name_ptd[32]       get_user_name(ptr, name_ptr, 31)       get_user_name(ptd, name_ptd, 31)       client_print(0, print_chat, "%s touched %s", name_ptr, name_ptd)     }   } }
More is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-25-2005 , 15:31  
Reply With Quote #3

Would this work if a player attacked another teammate with a knife?
__________________
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
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 04-25-2005 , 15:33  
Reply With Quote #4

No... what do you need knifeness for so badly?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-25-2005 , 15:34  
Reply With Quote #5

Bah, nothing.. I'll just go by my original idea.
__________________
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
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-28-2005 , 23:01  
Reply With Quote #6

register_touch is better.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Cronck
Member
Join Date: Apr 2005
Old 04-29-2005 , 06:30  
Reply With Quote #7

I really dont want to registrer an event, id rather use a native which tells if they're touching eachother at the moment its called
Cronck is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-29-2005 , 13:00  
Reply With Quote #8

It is not registering an event.

Code:
register_touch(classname[],classname[],function[])

It fuctions by calling the function you specify when two objects of the provided classname touch. It is exactly like pfn_touch, but instead of seeing if the classnames are what you want in SMALL, it does it in the module, where it is much faster.

The end result is you get when two SPECIFIC things touch, like two players, so you do not have to compare classnames all the time and waste CPU.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Reply


Thread Tools
Display Modes

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 16:39.


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