This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Solved Stale Variable problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
N3v3rM1nd
Member
Join Date: Apr 2021
Old 05-10-2024 , 06:41   Re: Stale Variable problem
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Is the expectation that g_cName[] always has the users current name? If so, where are you setting the name to that array when the name gets changeed?
Yes, g_cName[] holds the user's current name, idk how to replace the value, so i tried with copy()

PHP Code:
public ChangeNick(iPlayer)
{
    if(!
GetAccess(iPlayerADMIN_KICK3))
        return 
1;
        
    new 
cArg[32];
    new 
iTargetcNickname[32];
    
read_argv(1cArgsizeof(cArg)-1);
    
read_argv(2cNicknamesizeof(cNickname)-1);
    
iTarget GetTarget(iPlayercArgFLAG_CHECK_IMMUNITY);
    
    if(!
iTarget)
        return 
1;

    
PrintToChat(0,"^x01[ADMIN]^x04 %s^x01: changed ^x04%s^x01's nickname to ^x03%s"g_cName[iPlayer], g_cName[iTarget], cNickname);
    
set_user_info(iTarget"name"cNickname)
    
client_cmd(iTarget"name ^"%s^""cNickname);
    
copy(g_cName[iTarget], 32cNickname// copy the new nickname into g_cName[]
    
return 1;

also here
PHP Code:
verify_name(id)
{
    static 
name[32]
    
get_user_info(id"name"name31)
        
    static 
iignore
    ignore 
false
        
    
for (0<= g_sizeof_names_newi++)
    {
        if(
containi(nameg_names_new[i]) != -1)
        {
            
ignore true
            
break;
        }
    }
        
    if(
ignore)
        return;
        
    for (
029i++)
        
replace_all(name31g_filter_chars"")
        
    for (
0g_sizeof_namesi++)
    {
        if(
containi(nameg_names[i]) != -&& !g_bFake[i])
        {
            
formatex(name31"%s [%d]"g_names_new[random_num(0g_sizeof_names_new)], g_names_changed)
            
set_user_info(id"name"name)
            
client_cmd(id"name ^"%s^""name)
            
copy(g_cName[i], 32name// same, tried to copy the new name into g_cName[]
            
g_names_changed++
        }
    }

but same results

Last edited by N3v3rM1nd; 05-10-2024 at 06:45.
N3v3rM1nd is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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