SA-MP Forums Archive
Help with float - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help with float (/showthread.php?tid=662429)



Help with float - Leaky - 01.01.2019

I had stop scripting for a good while now and one of my friends asked me to make them a ATM system for his DM server, I was building it with y_ini since his server system is ini based, anyways i made the system well, it creates and deletes the atm's as intended, it saves them aswell but when i'm trying to load them back thats where the issue is. It's giving me errors and i'm kind of sure that I'm doing this right, take a look

PHP код:
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1906) : error 017undefined symbol "name"
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1906) : error 017undefined symbol "value"
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1907) : error 017undefined symbol "name"
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1907) : error 017undefined symbol "value"
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1908) : error 017undefined symbol "name"
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1908) : error 017undefined symbol "value"
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1909) : error 017undefined symbol "name"
C:\Users\ishalee\Desktop\Pawno\gamemodes\GDM.pwn(1909) : error 017undefined symbol "value"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
8 Errors

PHP код:
    new path[32];
    for(new 
a=0;a<MAX_ATM;a++)
    {
        
format(path,sizeof(path),"GDM/Atms/atm_ID_%d.txt",a);
        if(!
fexist(path)) continue;
          {
            
INI_Float("aX",atmInfo[a][aX]);//error line 1
            
INI_Float("aY",atmInfo[a][aY]);//error line 2
            
INI_Float("aZ",atmInfo[a][aZ]);//error line 3
            
INI_Float("aA",atmInfo[a][aA]);//error line 4
            
            
atmInfo[a][aObject] = CreateDynamicObject(ATM,atmInfo[a][aX],atmInfo[a][aY],atmInfo[a][aZ]-0.5,0.0,0.0,atmInfo[a][aA]-180,-1,-1,-1,150.55);
            
atmInfo[a][aText] = Create3DTextLabel(""ATM_MSG"",-1,atmInfo[a][aX],atmInfo[a][aY],atmInfo[a][aZ]+1,10.0,0,0);
        }
     } 



Re: Help with float - Leaky - 01.01.2019

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Your bad indentation is hiding what the code is actually doing:

PHP код:
if(!fexist(path)) continue; 
This will skip the entire loop then the block below will run regardless. But the way you've used braces here leads me to believe that you did not intend for this (this is a really strange use of scope, which is why I assume it's a mistake).

As for the undefined symbols, none of that code contains those symbols (read the actual error messages and the lines of code you've highlighted). You're going to have to share more details about your code. You've likely allocated those variables in some other scope somewhere and are trying to use them outside of that scope. Those are not typical global variable names so I assume they are local.
Updated code

PHP код:
stock CreateATM(Float:x,Float:y,Float:z,Float:a)
{
    new 
atmid NextUnusedATM();
    new 
path[32];
    
format(path,sizeof(path),"GDM/Atms/atm_ID_%d.txt",atmid);
    new 
INI:File INI_Open(path);
    
INI_SetTag(File,"data");
    
INI_WriteFloat(File"atmX"x);
    
INI_WriteFloat(File"atmY"y);
    
INI_WriteFloat(File"atmZ"z);
    
INI_WriteFloat(File"atmA"a);
    
INI_Close(File);
    
atmInfo[atmid][atmX]=x;
    
atmInfo[atmid][atmY]=y;
    
atmInfo[atmid][atmZ]=z;
    
atmInfo[atmid][atmA]=a;
    
atmInfo[atmid][aObject]= CreateDynamicObject(ATM_OBJECT,x,y,z-0.5,0.0,0.0,a-180,-1,-1,-1,150.55);
    
atmInfo[atmid][aText]= Create3DTextLabel("--------[ ATM ]--------\n/awithdraw /adeposit /abalance",-1,x,y,z+1,50.0,0,0);
    return 
atmid;
}
enum aTM
{
    
Float:atmX,
    
Float:atmY,
    
Float:atmZ,
    
Float:atmA,
    
aObject,
    
Text3D:aText
}
new 
atmInfo[MAX_ATM][aTM];
new 
path[32]; 
    for(new 
a=0;a<MAX_ATM;a++) 
    { 
        
format(path,sizeof(path),"GDM/Atms/atm_ID_%d.txt",a); 
        if(!
fexist(path)) continue; 
            
INI_Float("atmX",atmInfo[a][atmX]);//error line 1 
            
INI_Float("atmY",atmInfo[a][atmY]);//error line 2 
            
INI_Float("atmZ",atmInfo[a][atmZ]);//error line 3 
            
INI_Float("atmA",atmInfo[a][atmA]);//error line 4