Raised This Month: $51 Target: $400
 12% 

Trigger script function using trigger_multiple


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
felhasznalo
AlliedModders Donor
Join Date: Aug 2015
Location: Hungary
Old 03-05-2022 , 17:45   Trigger script function using trigger_multiple
Reply With Quote #1

Is it possible to trigger an AMXX function using a trigger_multiple found on a map?

I can check for touch using something like this and check for entity targetname in the callback:
PHP Code:
register_touch("trigger_multiple""player""touch_callback"
But the function is called continuously when the player is touching the entity.

Is it possible to check when the player leaves the trigger_multiple zone?

Or just keep the last touch time event by player ids and trigger a function on a cooldown?

Last edited by felhasznalo; 03-05-2022 at 17:46.
felhasznalo is offline
Fixsek Kot
Member
Join Date: Feb 2022
Old 03-06-2022 , 05:37   Re: Trigger script function using trigger_multiple
Reply With Quote #2

Try this, it's not tested but it should work:
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>

new InTrigger[33]

public 
plugin_init() {
    
register_plugin("touch_multiple""1.0""some cool boi")
    
register_touch("trigger_multiple""player""touch_handler")
}
public 
client_putinserver(id)
{
    
InTrigger[id] = 0
}
public 
touch_handler(ident)
{
    new 
target[32]
    
pev(entpev_classnametarget31)
    if(
equali(target"name_of_the_trigger"))
    {
        if(
InTrigger[id]) return 1
        
//Write here what do you want to happen
        
InTrigger[id] = 1
    
}
    else
    {
        
InTrigger[id] = 0
    
}
    return 
1


Last edited by Fixsek Kot; 03-06-2022 at 05:38.
Fixsek Kot is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-06-2022 , 07:08   Re: Trigger script function using trigger_multiple
Reply With Quote #3

Hook entity think instead of entity touch and check whether the player bounding box is inside the trigger_multiplie.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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:40.


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