AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Must be assigned to an array (https://forums.alliedmods.net/showthread.php?t=171878)

EclipseCP 11-12-2011 05:37

Must be assigned to an array
 
hi all

I get the error Must be Assigned to an array in the following line:

PHP Code:

for (06i++) g_character_slot[id][i] = temp 

the entire code:

PHP Code:

new g_character_slot[33][5]

// ---------------------
    
new id data[0]
    
    
loading(id)
    
    if (
SQL_NumResults(query))
    {
        new 
temp[32], i
        
        SQL_ReadResult
(queryi++, tempcharsmax(temp))
        
        for (
06i++) g_character_slot[id][i] = temp
        
        g_type
[id] = LOAD
        
        MENU_account
(id)     
    } 


jim_yang 11-12-2011 06:32

Re: Must be assigned to an array
 
i < 6 to i < 5

Bugsy 11-12-2011 07:37

Re: Must be assigned to an array
 
temp is a string (multiple cells) and you are trying to fit it into a single cell. You must add a third dimension so each player has 5 strings instead of 5 regular cells, I used 10 as the max size but this can be changed depending on what you need. Explain better what you're storing in this array if the below doesn't solve your problem. This is just going to copy the same string 5 times, I'm not sure what you're trying to do, explain and it can get done correctly.

PHP Code:

new g_character_slot[33][5][10]

for (
0sizeofg_character_slot[] ) ; i++) 
   
copyg_character_slot[id][i] , charsmaxg_character_slot[][] ) , temp ); 



All times are GMT -4. The time now is 14:24.

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