Raised This Month: $ Target: $400
 0% 

ArrayGetArray bad values


Post New Thread Reply   
 
Thread Tools Display Modes
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
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 08-23-2012 , 22:45   Re: ArrayGetArray bad values
Reply With Quote #2

Code:
console_print(0, "FLOAT1=%f", Data[FLOAT1]) console_print(0, "FLOAT2=%f", Data[FLOAT2]) console_print(0, "INT=%d", Data[INT])
__________________
The functional way is the right way

Last edited by GordonFreeman (RU); 08-23-2012 at 22:46.
GordonFreeman (RU) is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 08-23-2012 , 22:49   Re: ArrayGetArray bad values
Reply With Quote #3

Quote:
Originally Posted by GordonFreeman (RU) View Post
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
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 08-23-2012 , 22:55   Re: ArrayGetArray bad values
Reply With Quote #4

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) ♂╙♦,
__________________
The functional way is the right way
GordonFreeman (RU) is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-23-2012 , 23:01   Re: ArrayGetArray bad values
Reply With Quote #5

Each slot in your dynamic array is only a single cell yet you are trying to store more than a single cell of information.
__________________

Last edited by fysiks; 08-23-2012 at 23:01.
fysiks is offline
GordonFreeman (RU)
Veteran Member
Join Date: Jan 2010
Location: Uzbekistan
Old 08-23-2012 , 23:02   Re: ArrayGetArray bad values
Reply With Quote #6

Code:
g_Array = ArrayCreate(1,1)
LOOOL
__________________
The functional way is the right way
GordonFreeman (RU) is offline
rak
Veteran Member
Join Date: Oct 2011
Location: banned country
Old 08-23-2012 , 23:13   Re: ArrayGetArray bad values
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
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
__________________

www.amxmodx-es.com

Steam: Luchokoldo
rak is offline
Send a message via MSN to rak Send a message via Skype™ to rak
Reply


Thread Tools
Display Modes

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 01:51.


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