Raised This Month: $32 Target: $400
 8% 

register touch problem,two players touching the same entity in the same time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mrshark45
Member
Join Date: Jan 2016
Old 11-23-2018 , 07:21   register touch problem,two players touching the same entity in the same time
Reply With Quote #1

I made an entity and I want to call a function everytime a player touches it , but if two players touch it in the same time the function will not be called,how can I deal with this?




PHP Code:
    register_touch(gszFinish"player""fwTouch");
    
register_touch("player"gszFinish"fwTouch2");
    
register_touch(gszStart"player""fwTouch3");
    
register_touch("player"gszStart"fwTouch4");


public 
fwTouch(entid){
    if(
gfStartRun[id] <= 0.0)
        return;
        
    if(!
gbFinished[id]){
        
Create_Box(ident);
        
gbFinished[id] = true;
        
fwFinished(id);
    }
    
}
public 
fwTouch2(ident){
    
fwTouch(entid);
}
public 
fwTouch3(entid){
        
//Create_Box(id, ent);
        
gbFinished[id] = false;
        
fwStarted(id);
}

public 
fwTouch4(ident){
    
fwTouch3(ent,id);

mrshark45 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-23-2018 , 13:56   Re: register touch problem,two players touching the same entity in the same time
Reply With Quote #2

1st what is gszStart and whats gszFinish and why are you registering the touch twice?
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 11-23-2018 at 13:56.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
mrshark45
Member
Join Date: Jan 2016
Old 11-24-2018 , 20:51   Re: register touch problem,two players touching the same entity in the same time
Reply With Quote #3

The problem was from semiclip and gszStart and gszFinish are two entities.
mrshark45 is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 11-25-2018 , 08:32   Re: register touch problem,two players touching the same entity in the same time
Reply With Quote #4

He speak you about this.
Quote:
register_touch(gszFinish, "player", "fwTouch");
register_touch("player", gszFinish, "fwTouch2");
You have two hooks for the same thing.
X touch Y = Y touch X.
That means you can do the job with only one hook: player touch finish.
The same for the start entity.
__________________
My English is A0

Last edited by E1_531G; 11-25-2018 at 08:33.
E1_531G 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 22:28.


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