AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   engfunc : EngFunc_InfoKeyValue (https://forums.alliedmods.net/showthread.php?t=307218)

ish12321 05-01-2018 05:33

engfunc : EngFunc_InfoKeyValue
 
engfunc(EngFunc_InfoKeyValue, buffer, "name", val, 31)

Could someone explain what does this part of code does ?
I searched funcwiki but found nothing about engfunc

instinctpt1 05-01-2018 07:30

Re: engfunc : EngFunc_InfoKeyValue
 
https://wiki.alliedmods.net/FakeMeta...d_Descriptions

Most probably it is using engfunc to store name :/
( Guess )

Take Reference from this too : https://forums.alliedmods.net/showthread.php?t=204620

ish12321 05-01-2018 23:04

Re: engfunc : EngFunc_InfoKeyValue
 
Quote:

Originally Posted by instinctpt1 (Post 2590243)
https://wiki.alliedmods.net/FakeMeta...d_Descriptions

Most probably it is using engfunc to store name :/
( Guess )

Take Reference from this too : https://forums.alliedmods.net/showthread.php?t=204620

In that case, is it same as get_user_name?

ish12321 05-05-2018 14:46

Re: engfunc : EngFunc_InfoKeyValue
 
Code:

public RG_Hook_ClientUserInfoChanged(const id, infobuffer[])
{
        if((g_IsStarted || g_KnifeRound) && get_pcvar_num(g_iPCvars[CVAR_TEAMTAG]))
        {
                if(is_user_connected(id))
                {
                        new szName[MAX_NAME_LENGTH], szNewName[MAX_NAME_LENGTH];
                        get_user_name(id, szName, charsmax(szName));

                        copy(szNewName, charsmax(szNewName), szName);
                        if (g_bSecondHalf)
                        {
                                if (get_member(id, m_iTeam) == TEAM_TERRORIST)
                                {
                                        if(contain(szNewName, "B.") != 0)
                                        {
                                                format(szNewName, charsmax(szNewName), "%L %s", LANG_PLAYER, "TEAM_B", szNewName);
                                        }
                                }
                                else if(get_member(id, m_iTeam) == TEAM_CT)
                                {
                                        if(contain(szNewName, "A.") != 0)
                                        {
                                                format(szNewName, charsmax(szNewName), "%L %s", LANG_PLAYER, "TEAM_A", szNewName)
                                        }
                                }
                        }
                        else
                        {
                                if(get_member(id, m_iTeam) == TEAM_TERRORIST)
                                {
                                        if(contain(szNewName, "A.") != 0)
                                        {
                                                format(szNewName, charsmax(szNewName), "%L %s", LANG_PLAYER, "TEAM_A", szNewName)
                                        }
                                }
                                else if(get_member(id, m_iTeam) == TEAM_CT)
                                {
                                        if(contain(szNewName, "B.") != 0)
                                        {
                                                format(szNewName, charsmax(szNewName), "%L %s", LANG_PLAYER, "TEAM_B", szNewName);
                                        }
                                }
                        }
                       
                        if(!equal(szName, szNewName))
                        {
                                set_user_info(id, "name", szNewName);
                        }                       
                }
        }
}

Could someone point out error in it ? get_user_name is not getting the name to which the player is just changing name to but his previous name .. !! :-\ Do I need use EngFunc_InfoKeyValue ?

fysiks 05-05-2018 15:52

Re: engfunc : EngFunc_InfoKeyValue
 
Quote:

Originally Posted by ish12321 (Post 2590232)
engfunc(EngFunc_InfoKeyValue, buffer, "name", val, 31)

In the FM_ClientUserInfoChanged message, the hasn't yet changed. So, get_user_name() will return the actual current name (can be thought of as "old name"). The info in the buffer will contain all the new information that will be used to update your info. That means that this buffer will contain the "new name". The engfunc() retreives that name from the buffer.

fvRate 05-05-2018 16:47

Re: engfunc : EngFunc_InfoKeyValue
 
Maybe changing names is already block is some other hooked function.
Also don't check the whole name, since you are only concerned about the first two chars, then make it check only the first two chars.


All times are GMT -4. The time now is 04:34.

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