AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   register touch problem,two players touching the same entity in the same time (https://forums.alliedmods.net/showthread.php?t=312250)

mrshark45 11-23-2018 07:21

register touch problem,two players touching the same entity in the same time
 
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);



Natsheh 11-23-2018 13:56

Re: register touch problem,two players touching the same entity in the same time
 
1st what is gszStart and whats gszFinish and why are you registering the touch twice?

mrshark45 11-24-2018 20:51

Re: register touch problem,two players touching the same entity in the same time
 
The problem was from semiclip and gszStart and gszFinish are two entities.

E1_531G 11-25-2018 08:32

Re: register touch problem,two players touching the same entity in the same time
 
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.


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

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