AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Code Snippets/Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=83)
-   -   [INFO] Fakemeta & Ham detailed function descriptions and examples (https://forums.alliedmods.net/showthread.php?t=93229)

meTaLiCroSS 07-26-2014 19:40

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
 
Fakemeta function:
Code:

EngFunc_CanSkipPlayer


Description:
Returns 1 or 0 depending of client's cl_lw cvar value (if cl_lw different from 0, returns 1). This functions is used by the mod for checking if player has weapon prediction enabled. Mod uses CanSkipPlayer on weapons, directly on SendWeaponAnim function.

If client haves cl_lw cvar enabled, it means that haves weapon prediction enabled = no need to send weapons animations.
Usage:

PHP Code:

if(engfunc(EngFunc_CanSkipPlayer(index))
{
    
// client has weapon prediction enabled
}
else
{
    
// client has weapon prediction disabled, server will sent him everything from his weapons.


Parameters:
index = client's index (must be a player)

Not really an important snippet, but it will be useful for someone. May this function be unknown for a lot of scripters.

meTaLiCroSS 07-26-2014 19:49

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
 
Fakemeta function:
Code:

EngFunc_Time


Description:
Returns time in seconds (float) since the game started. Rather the same as tickcount(). It seems to not be used by the mod (it's useless anyway).
Usage:

PHP Code:

new Float:flElapsedTime Float:engfunc(EngFunc_Time)
server_print("%.2f seconds passed since the server started"flElapsedTime

PHP Code:

new Float:flStartTime Float:engfunc(EngFunc_Time)
MyVeryBigFunction()
AnotherHugeFunction()
SpamArkshineSteamChat()
server_print("Execution time: %f"Float:engfunc(EngFunc_Time) - flStartTime

Parameters:
no params for this function

Another not really important function, but as many others, it's unknown for many scripters.

HamletEagle 09-08-2014 10:44

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
 
@meTaLiCroSS, from what I see EngFunc_Time acts like get_gametime. AFAIK the value returned by get_gametime is increased only in next frame. In your last example, if the execution of the 3 private functions happen in the same frame, it will print 0. Is this right ?

meTaLiCroSS 09-12-2014 20:00

Re: [INFO] Fakemeta & Ham detailed function descriptions and examples
 
Quote:

Originally Posted by HamletEagle (Post 2195437)
@meTaLiCroSS, from what I see EngFunc_Time acts like get_gametime. AFAIK the value returned by get_gametime is increased only in next frame. In your last example, if the execution of the 3 private functions happen in the same frame, it will print 0. Is this right ?

I posted it because I researched the engine and found it usage, it has nothing to do with get_gametime(). Time will always return a difference of time (substracting 2 values from get_systime() as example)


All times are GMT -4. The time now is 09:43.

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