Instead of putting a timer on the touch, you can track the last player that was touched and not register a touch again until a different player is touched.
1 touches 2 [touch fires]
1 touches 2 [nothing happens]
1 touches 2 [nothing happens]
1 touches 4 [touch fires]
1 touches 4 [nothing happens]
1 touches 2 [touch fires]
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#define MAX_PLAYERS 32
#define IsPlayer(%1) (1<=%1<=MAX_PLAYERS)
new g_LastTouched[ MAX_PLAYERS + 1 ];
public plugin_init()
{
RegisterHam( Ham_Touch , "player" , "PlayerTouch" );
}
public client_connect( id )
{
g_LastTouched[ id ] = 0;
}
public PlayerTouch( id , player )
{
if ( IsPlayer( id ) && IsPlayer( player ) )
{
if ( g_LastTouched[ id ] != player )
{
//Touched player
client_print( id , print_chat , "Touched %d" , player );
}
g_LastTouched[ id ] = player;
}
}
__________________