Raised This Month: $ Target: $400
 0% 

How does "return" work?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-27-2020 , 15:41   Re: How does "return" work?
Reply With Quote #2

In general, a return value is the value returned by the function. If the function is being called from a hook provided by a module then there are special constants to signify to the hooking module what do do. This depends on the module for what the different values do. For AMX Mod X module, you have PLUGIN_* constants then for fakemeta you have FMRES_* constants and for Hamsandwich you have HAM_* constants.

Each of the modules have their own meaning for the return values and you can look at return value definitions (in their include file for constants, usually *_const.inc) and if that isn't enough, you can search specifically for the one you want on the forum (I've seen threads that talk about most of them if not all).

For Fakemeta and Hamsandwich, if you hook a function as a pre-hook then certain return values will allow you to modify the function before it is sent to the game engine or prevent the function from occurring at all. For example, if you hook Ham_TakeDamage as pre, you can change how much damage the engine thinks was taken by a player.

Here is one such explanation of PLUGIN_* values which is basically what it says in amxconst.inc.

The question mark is the ternary operator. Search for it online (and I'm sure it's been explained here as well).
__________________

Last edited by fysiks; 06-27-2020 at 15:49.
fysiks is offline
 



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 17:10.


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