SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 21/02/2013, 04:14 AM   #1
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 603
Reputation: 69
Lightbulb Concept for native function hooks



In a module based script, there's times where I need to hook a native function more than once.. I've been trying to figure out a way to keep the actual SetPlayerArmor intact, then have additional code hooked onto that function. My idea was to have main.pwn basically be a header hook that has the actual function inside it; then the rest acting as added code. I'm curious to see what others think of this. It's almost like turning SetPlayerArmor into a callback; with additional hooks added.
__________________
Chaprnks is offline   Reply With Quote
Old 21/02/2013, 05:49 AM   #2
Psymetrix
Huge Clucker
 
Join Date: Oct 2011
Posts: 292
Reputation: 104
Default Re: Concept for native function hooks

I'm having the exact same problem. I have 10 include files, each with OnPlayerClickPlayerTextDraw hooked. All 10 files may, or may not come together in the end - this is my problem. A header file would be fine, if I didn't want each include to be stand-alone. I would prefer to hook once and call each includes own function, but that means knowing what files are included in advance. I don't want that if it can be helped.

I'm very new to multi-file scripting. Any documentation/tutorials on this subject would be appreciated.
Psymetrix is offline   Reply With Quote
Old 22/02/2013, 09:28 PM   #3
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 603
Reputation: 69
Default Re: Concept for native function hooks

You should organize the documentation in an easier to read format.. This isn't the first time I've seen someone have a question, that is already documented deep in the pile of posts.


EDIT:
I'd be willing to help you document; I know what YSI is capable of, but without clear documentation of all that it can do.. its basically not seeing its full potential.
__________________
Chaprnks is offline   Reply With Quote
Old 23/02/2013, 02:58 PM   #4
MP2
Godfather
 
MP2's Avatar
 
Join Date: Jan 2011
Location: England
Posts: 6,237
Reputation: 1004
Default Re: Concept for native function hooks

Quote:
Originally Posted by Chaprnks View Post
You should organize the documentation in an easier to read format.. This isn't the first time I've seen someone have a question, that is already documented deep in the pile of posts.


EDIT:
I'd be willing to help you document; I know what YSI is capable of, but without clear documentation of all that it can do.. its basically not seeing its full potential.
*cough* http://forum.sa-mp.com/showthread.php?t=166016 *cough*
__________________
Owner and developer of Mike's Cops and Robbers.

Click here to visit our site and find out more. Click here to view trailers.
Enter referral code SAMPFORUM after registering for a $5000 starting bonus!
MP2 is offline   Reply With Quote
Old 24/02/2013, 01:31 AM   #5
LarzI
High-roller
 
LarzI's Avatar
 
Join Date: Apr 2007
Location: Norway
Posts: 2,628
Reputation: 136
Default Re: Concept for native function hooks

Quote:
Originally Posted by MP2 View Post
Quote:
Originally Posted by Chaprnks View Post
You should organize the documentation in an easier to read format.. This isn't the first time I've seen someone have a question, that is already documented deep in the pile of posts.


EDIT:
I'd be willing to help you document; I know what YSI is capable of, but without clear documentation of all that it can do.. its basically not seeing its full potential.
*cough* http://forum.sa-mp.com/showthread.php?t=166016 *cough*
*doublecough* http://ysi.wikia.com/wiki/YSI_Wiki *cough*
__________________


NEW: [FS] Simple Cellphones

if( strfind( title, "REP", true ) != -1 )
{________________________________________
Sigh();__________________________
}________________________________________


LarzI is offline   Reply With Quote
Old 24/02/2013, 07:30 AM   #6
Chaprnks
Gangsta
 
Chaprnks's Avatar
 
Join Date: Sep 2007
Location: Soviet America
Posts: 603
Reputation: 69
Default Re: Concept for native function hooks

Quote:
Originally Posted by LarzI View Post
Thanks!
__________________
Chaprnks is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[HELP]Redefine a native function xX_Simon_Xx Scripting Help 7 25/04/2012 12:05 PM
Function: Native Max_Coldheart Scripting Help 5 12/01/2012 02:59 PM
Native Setproperty function Jochemd Help Archive 4 16/01/2011 05:20 PM
qustion about Native function(); ғαιιοцт Help Archive 11 05/07/2009 06:31 PM


All times are GMT. The time now is 07:20 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.