Raised This Month: $ Target: $400
 0% 

how to use RegisterHam


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
1023168216
Member
Join Date: Jun 2013
Location: Tokyo
Old 06-05-2013 , 05:24   how to use RegisterHam
Reply With Quote #1

I'm a green hand. I meet some problems.
I don't know how to use RegisterHam and register_forward and register_touch and register_think.
I need help~~~ I need some simple codes about these four~~~ Give me some,please.
because what I found about these four are all very difficult for me to understand.
1023168216 is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-05-2013 , 05:36   Re: how to use RegisterHam
Reply With Quote #2

Code:
public plugin_init( )
        //                Offset,        ClassName, Function,               Post
        RegisterHam( Ham_Spawn, "player", "OnPlayerSpawn_Post", 1 );
        // Base Hook: Hook Entity when it's spawned
Code:
public plugin_init( )
        //                     Offset,                     Function,                 Post
        register_forward( FM_ClientPutInServer, "OnClientPutInServer", 0 );
        // Engine Function: Hook when player puts in the server
Code:
register_touch same as FM_Touch
register_think same as FM_Think

Last edited by TheDS1337; 06-05-2013 at 06:33.
TheDS1337 is offline
1023168216
Member
Join Date: Jun 2013
Location: Tokyo
Old 06-09-2013 , 11:00   Re: how to use RegisterHam
Reply With Quote #3

About "register_touch"and"register_think"??? can you please give me a example?
And i also wanna get some explain about something in "fakemeta_const.inc"
for example:what does "FM_CmdStart" mean???
i see it in this:register_forward(FM_CmdStart,"fw_CmdStar t")
1023168216 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-09-2013 , 19:11   Re: how to use RegisterHam
Reply With Quote #4

Quote:
Originally Posted by 1023168216 View Post
About "register_touch"and"register_think"??? can you please give me a example?
And i also wanna get some explain about something in "fakemeta_const.inc"
for example:what does "FM_CmdStart" mean???
i see it in this:register_forward(FM_CmdStart,"fw_CmdStar t")
All of your questions are already answered elsewhere. Search.
__________________
fysiks is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 06-05-2013 , 05:57   Re: how to use RegisterHam
Reply With Quote #5

The third argument in register_forward should be an integral value, not a string.
__________________
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-05-2013 , 06:33   Re: how to use RegisterHam
Reply With Quote #6

Quote:
Originally Posted by claudiuhks View Post
The third argument in register_forward should be an integral value, not a string.
Fixed
TheDS1337 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-06-2013 , 00:07   Re: how to use RegisterHam
Reply With Quote #7

Look at existing example, tutorials, and plugins.
__________________
fysiks is offline
President
Member
Join Date: May 2013
Old 06-09-2013 , 12:22   Re: how to use RegisterHam
Reply With Quote #8

PHP Code:
RegisterHam(Ham_*, "entity's_classname""Name_Of_Function"1); // 1 - after forward execute
RegisterHam(Ham_*, "entity's_classname""Name_Of_Function"0); // 0 - before forward execute
RegisterHam(Ham_*, "entity's_classname""Name_Of_Function"); // nothing - before forward execute


register_touch("classname_1""classname_2""Name_Of_Function");
// Example: register_touch("weaponbox", "player", "Player_touchs_Weapon");
// this touch will be executed when the player touch the weapon
// sth you have to know: when entity1 touch entity2, entity2 touch entity1, so the forward is executed 2 times


register_think("classname""Name_Of_Function");


register_forward(FM_CmdStart"fwdcmdstart");
// generally executed when player press any key ( both mouse and keyboard :D )


// Use register_think() and register_touch() instead of registering forwards FM_Think and FM_Touch.
// They are much faster.
// However not everything in engine is faster than fakemeta 
President is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 06-09-2013 , 13:47   Re: how to use RegisterHam
Reply With Quote #9

Those
Code:
RegisterHam(Ham_*, "entity's_classname", "Name_Of_Function", 0); // 0 - before forward execute RegisterHam(Ham_*, "entity's_classname", "Name_Of_Function"); // nothing - before forward execute
Are the same
TheDS1337 is offline
President
Member
Join Date: May 2013
Old 06-09-2013 , 14:22   Re: how to use RegisterHam
Reply With Quote #10

Quote:
Originally Posted by DeagLe.Studio View Post
Those
Code:
RegisterHam(Ham_*, "entity's_classname", "Name_Of_Function", 0); // 0 - before forward execute
RegisterHam(Ham_*, "entity's_classname", "Name_Of_Function"); // nothing - before forward execute
Are the same
Damn

Last edited by President; 06-09-2013 at 14:23.
President 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 16:13.


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