AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   player touch player with register_touch (https://forums.alliedmods.net/showthread.php?t=295031)

iNvectus 03-14-2017 07:15

player touch player with register_touch
 
Greetings.I recently started a plugin, which code I do not have at the moment, will add it later if needed.My question is the following: How can I register player1 touch player2 only one time.Example:
register_touch gives like 4~6 touches per second.I want one touch only.How can I achieve it? I've looked into FM_Touch and Ham_Touch, but couldn't understand FM_Touch and as far as I read the reference, Ham_Touch does not apply for players.

Thanks in advance!

jimaway 03-14-2017 07:22

Re: player touch player with register_touch
 
http://www.amxmodx.org/api/hamsandwi...ableHamForward

iNvectus 03-14-2017 07:30

Re: player touch player with register_touch
 
I see what it does.Can you give me an example, please? Thank you for the fast reply, tho! :)

edon1337 03-14-2017 08:41

Re: player touch player with register_touch
 
Who told you that Ham_Touch doesn't apply for players?

nea 03-14-2017 12:20

Re: player touch player with register_touch
 
what about this idea?
u can get 1 touch every 0.5 second between two player
PHP Code:

#include < amxmodx > 
#include < engine >
new gOldTouch[33][33]
new 
Float:gDiff 0.5 // Difference Between two Touches
public plugin_init( ) 

    
register_plugin"One Touch""1.0.0""Nea" ); 
    
register_touch("player","player","fn_PlayerTouchPlayer");

public 
fn_PlayerTouchPlayer(id_er,id_ed)
{
    if(
get_systime() - gOldTouch[id_er][id_ed] > gDiff || (get_systime() - gOldTouch[id_ed][id_er] > gDiff))
    {
        
gOldTouch[id_er][id_ed] = get_systime()
        
gOldTouch[id_ed][id_er] = get_systime()
        
        
// Here is Ur Code
        
return PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE



iNvectus 03-14-2017 18:26

Re: player touch player with register_touch
 
Basically, the code is the following.I liked ur method, nea, but the server gives me runtime error and crashes.If somebody help me analyze where the problem lies, I will be grateful.Any guides are going to be useful as well.

Natsheh 03-14-2017 20:15

Re: player touch player with register_touch
 
How about creating fkin boolean or a bitsum variable..

And use set task to reset it.

iNvectus 03-15-2017 12:33

Re: player touch player with register_touch
 
Quote:

Originally Posted by Natsheh (Post 2503711)
How about creating fkin boolean or a bitsum variable..

And use set task to reset it.

Well, yeah, I could do that, but the more important question here was, what am I doing wrong that when the two players touch, my HLDS wents not responding?

HamletEagle 03-15-2017 15:54

Re: player touch player with register_touch
 
It's expected to get multiple calls, touch is called as long as they touch.

iNvectus 03-15-2017 18:59

Re: player touch player with register_touch
 
Question - answered.Topic may be closed.Thanks.


All times are GMT -4. The time now is 17:54.

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