View Single Post
Author Message
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 08-23-2012 , 22:38   ArrayGetArray bad values
Reply With Quote #1

hi I have this problem, when I save the array in a dinamic array, obtained data gets saved in the wrong way. Just look

Plugin
PHP Code:
#include <amxmodx>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "[R]ak"

new Array:g_Array

enum _
:DataTest {
    
Float:FLOAT1,
    
Float:FLOAT2,
    
INT
}

public 
plugin_init() {
    
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_Array ArrayCreate(1,1)
    
    new 
Data[DataTest]
    
    
Data[FLOAT1] = _:27.0
    Data
[FLOAT2] = _:7.0
    Data
[INT] = 7
    
    console_print
(0"FLOAT1=%f | FLOAT2=%f | INT=%d"Data[FLOAT1], Data[FLOAT2], Data[INT])
    
console_print(0"FLOAT1=%f | FLOAT2=%f | INT=%d"Data[FLOAT1], Data[FLOAT2], Data[INT])
    
console_print(0"FLOAT1=%f | FLOAT2=%f | INT=%d"Data[FLOAT1], Data[FLOAT2], Data[INT])
    
    
ArrayPushArray(g_ArrayData)
    
}

public 
plugin_cfg() {
    
    new 
Data[DataTest]    
    
    
ArrayGetArray(g_Array0Data)
    
    
console_print(0"FLOAT1=%f | FLOAT2=%f | INT=%d"Data[FLOAT1], Data[FLOAT2], Data[INT])
    
console_print(0"FLOAT1=%f | FLOAT2=%f | INT=%d"Data[FLOAT1], Data[FLOAT2], Data[INT])
    
console_print(0"FLOAT1=%f | FLOAT2=%f | INT=%d"Data[FLOAT1], Data[FLOAT2], Data[INT])
    

output

Code:
plugin_init
FLOAT1=27.000000 | FLOAT2=7.000000 | INT=7
FLOAT1=27.000000 | FLOAT2=7.000000 | INT=7
FLOAT1=27.000000 | FLOAT2=7.000000 | INT=7
plugin_cfg
FLOAT1=27.000000 | FLOAT2=0.000000 | INT=0
FLOAT1=27.000000 | FLOAT2=0.000000 | INT=0
FLOAT1=27.000000 | FLOAT2=0.000000 | INT=0
any idea?

thanks for reading
__________________

www.amxmodx-es.com

Steam: Luchokoldo

Last edited by rak; 08-23-2012 at 22:41.
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak