AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   error 023: array assignment must be simple assignment (https://forums.alliedmods.net/showthread.php?t=220953)

Mofforg 07-16-2013 10:10

error 023: array assignment must be simple assignment
 
Here's a part of custom translit plugin to translate symbols and add some info to msg.

PHP Code:

    new p_Name[32]
    
get_user_name(id,p_Name,31)
    
    
format (s_Out191"^1%s"p_Name)
    
    if (
get_user_flags(id) & ADMIN_CHAT)
    {
        
s_Out += format (s_Out191"^1[^4Admin^1]:^4")
        
s_Color true
    
}
    else 
s_Out += format (s_Out191"^3 ");
    
    
s_Out += format (s_Out191" %s"sz_Msg)
    
    if ( 
s_Transl || s_Color )
    {
        
client_printcolor(0,s_Out)
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_CONTINUE 

In few lines, where i try to plus existed content with new content returns
PHP Code:

error 023: array assignment must be simple assignment 

PHP Code:

s_Out += format (s_Out191"^1[^4Admin^1]:^4")

else 
s_Out += format (s_Out191"^3 ");

s_Out += format (s_Out191" %s"sz_Msg

Why should it be wrong? I assume it should work because i don't know another way to plus strings.

YamiKaitou 07-16-2013 10:15

Re: error 023: array assignment must be simple assignment
 
You cannot do that with a String. You must use format(ex) or another command to combine multiple strings together

Mofforg 07-16-2013 10:21

Re: error 023: array assignment must be simple assignment
 
Quote:

Originally Posted by YamiKaitou (Post 1992099)
You cannot do that with a String. You must use format(ex) or another command to combine multiple strings together

Eeee, i am stupid.

This way?

PHP Code:

    formatex (s_Out191"^1%s"p_Name)
    
    if (
get_user_flags(id) & ADMIN_CHAT)
    {
        
formatex (s_Out191"%s^1[^4Admin^1]:^4"s_Out)
        
s_Color true
    




All times are GMT -4. The time now is 06:23.

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