AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   LookupLangKey has an &id argument? (https://forums.alliedmods.net/showthread.php?t=309119)

OciXCrom 07-14-2018 09:40

LookupLangKey has an &id argument?
 
PHP Code:

native LookupLangKey(Output[], OutputSize, const Key[], &id); 

I had to use this function for the first time and noticed that the id has an & in front. Why? This argument is supposed to be the player's id or LANG_SERVER, so why is the id saved in a variable? The function needs to be used like this because of it:

PHP Code:

new szFormat[32], id LANG_SERVER
LookupLangKey
(szFormatcharsmax(szFormat), "SOME_KEY"id

Instead of like this:

PHP Code:

new szFormat[32]
LookupLangKey(szFormatcharsmax(szFormat), "SOME_KEY"LANG_SERVER

There's no point of storing the id anywhere.
Am I missing something here?

Ghosted 07-14-2018 10:01

Re: LookupLangKey has an &id argument?
 
Yes think so as this code says

Code:

static cell AMX_NATIVE_CALL LookupLangKey(AMX *amx, cell *params)
{
        int len;
        char *key=get_amxstring(amx,params[3],0,len);
        const char *def=translate(amx, playerlang(*get_amxaddr(amx, params[4])),key);

        if (def==NULL)
        {
                return 0;
        }

        set_amxstring(amx,params[1],def,params[2]);
        return 1;
};

its getting param[4] & not setting.


All times are GMT -4. The time now is 12:29.

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