Raised This Month: $ Target: $400
 0% 

Converting from string to num/float problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
NucL3ra
Veteran Member
Join Date: Sep 2008
Location: Bucuresti , Romania
Old 04-14-2012 , 12:58   Converting from string to num/float problem
Reply With Quote #1

I can't convert some variables that I read from a file.

This is the code:
PHP Code:
new Float:SavedTime[33], SavedChecks[33], SavedGoChecks[33], Float:SavedOrigins[33][3]
........
new 
file fopen(tempfile"wt")
new 
vault fopen(realfile"rt")
new 
data[128], sid[32], time[25], checks[5], gochecks[5], x[25], y[25], z[25]
while( !
feof(vault) )
{
    
fgets(vaultdata127)
    
parse(datasid31time24,  checks4gochecks4x24,  y24z24)
    
    if( 
equal(sidauthid) && !exist)
    {
        
existtrue 
        SavedChecks
[id] = str_to_num(checks)
        
SavedGoChecks[id] = str_to_num(gochecks)
        
SavedTime[id] = str_to_float(time)
        
SavedOrigins[id][0]=str_to_float(x)
        
SavedOrigins[id][1]=str_to_float(y)
        
SavedOrigins[id][2]=str_to_float(z)
        
ColorChat(idGREEN"%s %f %d %d %f %f %f"sidSavedTimeSavedChecksSavedGoChecksSavedOrigins[0], SavedOrigins[1], SavedOrigins[2])
        
ColorChat(idGREEN"%s %s %s %s %s %s %s"sidtimechecksgochecksxyz)
    }
    else
    {
        
fputs(filedata
    }

On first print i get: STEAM_0:0:20106667 0.000000 0 0 0.000000 -1056964608.000000 0.000000
On second print: STEAM_0:0:20106667 25.000000 19 30 -1056964608 1098907648 -1042300928 (correct values)


I might be a little tired, but I really don't see my mistake...
__________________
My nickname is nucLeaR, I just screwed up at registering and didn't want to change after that X_X.

Last edited by NucL3ra; 04-14-2012 at 13:00.
NucL3ra is offline
Send a message via Yahoo to NucL3ra
 



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 07:50.


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