AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   About the Difference Of the Modules "fakemeta_util" and "fun" (https://forums.alliedmods.net/showthread.php?t=312505)

Jess98 12-06-2018 17:49

About the Difference Of the Modules "fakemeta_util" and "fun"
 
There are some same functions in these two modules.. Actually I can't be sure if they are same or not.. But in fun, they call as "natives" and in fakemeta_util, they call as "stocks". I want to ask 2 questions about that..

1 - What's the difference between "native" and "stock"? Do we use stock as how we use native?

2 - What's the difference between of these functions, do they have the same tasks? (And other ones that I didn't write here):

Code:

fm_get_user_godmode => get_user_godmode
Code:

fm_set_user_godmode => set_user_godmode
---

Code:

fm_get_user_gravity => get_user_gravity
Code:

fm_set_user_gravity => set_user_gravity
---

Code:

fm_get_user_maxspeed => get_user_maxspeed
Code:

fm_set_user_maxspeed => set_user_maxspeed
---

Code:

fm_give_item => give_item
---

* The left ones belong to fakemeta_util, the right ones belong to fun

Bugsy 12-06-2018 18:23

Re: About the Difference Of the Modules "fakemeta_util" and "fun"
 
They do the same thing, but fun does it with 1 native call versus many with fakemeta_util. Use fun when possible.

E1_531G 12-07-2018 14:15

Re: About the Difference Of the Modules "fakemeta_util" and "fun"
 
1. 'native' is a function that will make only 1 call to the module;
'stock' is a set of funtions, every function will make own call to the module.
2. See Bugsy's answer.

CrazY. 12-07-2018 14:44

Re: About the Difference Of the Modules "fakemeta_util" and "fun"
 
Avoid from use and/or create stock if is there one native that does same thing., even more if stock it's of fakemeta_util.

Bugsy 12-07-2018 18:09

Re: About the Difference Of the Modules "fakemeta_util" and "fun"
 
fakemeta_util re-creates many functions that already exist, but it is not ideal to use these unless you need to modify functionality in some way. In some cases, fakemeta_util completes a function that also exists in another module, such as fun, in 1 native call so there is really no negative aspect of using the fakemeta_util version. As E1_531G mentioned, less native calls are better. Below are examples of each:

godmode - Each result in 1 native call so there is really no difference.

fakemeta_util
Code:
stock fm_get_user_godmode(index) {     new Float:val;
    pev(index, pev_takedamage, val);
    return (val == DAMAGE_NO); }

fun
Code:
get_user_godmode()

strip_user_weapons - fakemeta_util requires 5 native calls while the fun version is only 1. For this, fun would be ideal, unless you needed to modify functionality in some way.

fakemeta_util
Code:
stock fm_strip_user_weapons(index) {
    new ent = fm_create_entity("player_weaponstrip");
   
    if (!pev_valid(ent))
        return 0;
    dllfunc(DLLFunc_Spawn, ent);
    dllfunc(DLLFunc_Use, ent, index);
    engfunc(EngFunc_RemoveEntity, ent);
    return 1; }

fun
Code:
strip_user_weapons

HamletEagle 12-08-2018 04:10

Re: About the Difference Of the Modules "fakemeta_util" and "fun"
 
Note that fakemeta_util also contains some stocks that are not conversions of existing natives, which are useful and can be used.


All times are GMT -4. The time now is 11:44.

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