AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Call a function when two players touch? (https://forums.alliedmods.net/showthread.php?t=131630)

GXLZPGX 07-07-2010 05:53

Call a function when two players touch?
 
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!

hleV 07-07-2010 07:17

Re: Call a function when two players touch?
 
PHP Code:

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



PattyBiena 07-07-2010 12:46

Re: Call a function when two players touch?
 
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)
    }




All times are GMT -4. The time now is 07:11.

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