Raised This Month: $ Target: $400
 0% 

Call a function when two players touch?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 07-07-2010 , 05:53   Call a function when two players touch?
Reply With Quote #1

How can I do this?

Edit: Could I use engine? Like:

PHP Code:
if( get_entity_distance(ent1ent2) == 0.0 
or

PHP Code:
register_touch(const Touched[], const Toucher[], const function[]); 
Sadly I have no idea what the entity is for a player!
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.

Last edited by GXLZPGX; 07-07-2010 at 05:57.
GXLZPGX is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-07-2010 , 07:17   Re: Call a function when two players touch?
Reply With Quote #2

PHP Code:
#include <engine>
 
public plugin_init()
{
        new 
ClassName[] = "player";
 
        
register_touch(ClassNameClassName"PlayersTouch");
}
 
public 
PlayersTouch(TouchedToucher)
{
        
// Stuff

__________________
hleV is offline
PattyBiena
BANNED
Join Date: Jul 2010
Location: Argentina
Old 07-07-2010 , 12:46   Re: Call a function when two players touch?
Reply With Quote #3

PHP Code:
#include <amxmodx>
#include <engine>

public plugin_init() register_touch("player""player""touch_players")

public 
touch_players(touchedtoucher)
{
    if (
is_user_alive(touched) && is_user_alive(toucher))
    {
        static 
name[32], name2[32]
        
get_user_name(touchednamecharsmax(name))
        
get_user_name(touchername2charsmax(name2))
        
        
client_print(toucherprint_center"%s touching your ass!"name)
        
client_print(touchedprint_center"%s touching your ass!"name2)
    }

PattyBiena 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 07:11.


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