Thread: FM_Time
View Single Post
iNvectus
Member
Join Date: Sep 2014
Location: Bulgaria
Old 11-13-2019 , 02:30   Re: FM_Time
Reply With Quote #2

FM_Time is the total uptime of the server. It needs no arguments from what I see in the source:

Code:
    case FM_Time:         fId = MF_RegisterSPForwardByName(amx, funcname, FP_DONE);         ENGHOOK(Time);         break;

and it is natively calling engfunc:
Code:
// pfnTime SIMPLE_FLOAT_HOOK_VOID(Time);

Code:
#define SIMPLE_FLOAT_HOOK_VOID(call) \     float call () \     { \         FM_ENG_HANDLE(FM_##call, (Engine[FM_##call].at(i))); \         RETURN_META_VALUE(mswi(lastFmRes), (float)mFloatResult); \     } \     float call##_post () \     { \         FM_ENG_HANDLE_POST(FM_##call, (EnginePost[FM_##call].at(i))); \         RETURN_META_VALUE(MRES_IGNORED, (float)mFloatResult); \     }

So what we have so far?

You have several ways of doing this:
  • Hooking FM_Time for unknown reason
  • Calling engfunc directly

Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_plugin("Blabla", "1.0", "blabla");     register_forward(FM_Time, "fwFmTime");     register_srvcmd("fmtest", "cmdFmTest"); } /*! EngFunc */ public fmTest() {     server_print("FM_Time aka EngFunc_Time: %f", engfunc(EngFunc_Time)); } /*! Hooking */ public fwFmTime() {     // We are inside }
__________________
iNvectus is offline