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

player touch player with register_touch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 03-14-2017 , 07:15   player touch player with register_touch
Reply With Quote #1

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!
iNvectus is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 03-14-2017 , 07:22   Re: player touch player with register_touch
Reply With Quote #2

http://www.amxmodx.org/api/hamsandwi...ableHamForward
jimaway is offline
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 03-14-2017 , 07:30   Re: player touch player with register_touch
Reply With Quote #3

I see what it does.Can you give me an example, please? Thank you for the fast reply, tho!
iNvectus is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-14-2017 , 08:41   Re: player touch player with register_touch
Reply With Quote #4

Who told you that Ham_Touch doesn't apply for players?
__________________
edon1337 is offline
nea
Junior Member
Join Date: Jan 2017
Old 03-14-2017 , 12:20   Re: player touch player with register_touch
Reply With Quote #5

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


Last edited by nea; 03-14-2017 at 12:27.
nea is offline
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 03-14-2017 , 18:26   Re: player touch player with register_touch
Reply With Quote #6

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.

Last edited by iNvectus; 03-15-2017 at 18:58. Reason: removed code.Topic may be closed.
iNvectus is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 03-14-2017 , 20:15   Re: player touch player with register_touch
Reply With Quote #7

How about creating fkin boolean or a bitsum variable..

And use set task to reset it.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 03-14-2017 at 20:16.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 03-15-2017 , 12:33   Re: player touch player with register_touch
Reply With Quote #8

Quote:
Originally Posted by Natsheh View Post
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?

Last edited by iNvectus; 03-15-2017 at 12:33.
iNvectus is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-15-2017 , 15:54   Re: player touch player with register_touch
Reply With Quote #9

It's expected to get multiple calls, touch is called as long as they touch.
__________________
HamletEagle is offline
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 03-15-2017 , 18:59   Re: player touch player with register_touch
Reply With Quote #10

Question - answered.Topic may be closed.Thanks.
iNvectus 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 11:08.


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