AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ArrayGetArray bad values (https://forums.alliedmods.net/showthread.php?t=193929)

rak 08-23-2012 22:38

ArrayGetArray bad values
 
hi :3 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 :3

GordonFreeman (RU) 08-23-2012 22:45

Re: ArrayGetArray bad values
 
Code:
console_print(0, "FLOAT1=%f", Data[FLOAT1]) console_print(0, "FLOAT2=%f", Data[FLOAT2]) console_print(0, "INT=%d", Data[INT])

rak 08-23-2012 22:49

Re: ArrayGetArray bad values
 
Quote:

Originally Posted by GordonFreeman (RU) (Post 1780918)
Code:
console_print(0, "FLOAT1=%f", Data[FLOAT1]) console_print(0, "FLOAT2=%f", Data[FLOAT2]) console_print(0, "INT=%d", Data[INT])

are you kidding me?

xD

GordonFreeman (RU) 08-23-2012 22:55

Re: ArrayGetArray bad values
 
no xD
just try, i also got wrong data in my weapon factory spawner plugin. it return "~♀NJ7̑" instead of my data
after separate it works fine o.0
Code:
"fprintf(file,"%s ",classname)"                         ArrayGetArray(g_origins,i,origin)             ArrayGetArray(g_angles,i,angle)                         fprintf(file,"^"%.0f %.0f %.0f^" ^"%.0f %.0f %.0f^"^n",origin[0],origin[1],origin[2],angle[0],angle[1],angle[2])
i dont understand, but if
Code:
fprintf(file,"%s ^"%.0f %.0f %.0f^" ^"%.0f %.0f %.0f^"^n",classname,origin[0],origin[1],origin[2],angle[0],angle[1],angle[2])
i returns following:
Code:

weapon_shotgun "-561.2 <start of asci character, that i cant write> (null) ♂╙♦,

fysiks 08-23-2012 23:01

Re: ArrayGetArray bad values
 
Each slot in your dynamic array is only a single cell yet you are trying to store more than a single cell of information.

GordonFreeman (RU) 08-23-2012 23:02

Re: ArrayGetArray bad values
 
Code:
g_Array = ArrayCreate(1,1)
LOOOL

rak 08-23-2012 23:13

Re: ArrayGetArray bad values
 
Quote:

Originally Posted by fysiks (Post 1780933)
Each slot in your dynamic array is only a single cell yet you are trying to store more than a single cell of information.

lol xD my bad thanks :3


All times are GMT -4. The time now is 05:48.

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