Slight issue with Y_INI. Working, but messed up in the ini file
#1

pawn Код:
Model = 429
Location_X = 1529.599975
Location_Y = -1691.199951
Location_Z = 13.097030
Angle = 316.994476
Color_1 = 1
Color_2 = 1
Owner = test123_sdlsdsd
Owned = 1
Locked = 0
Paintjob = 999
VirtualWorld = 0
Component0 = 0
Component1 = 0
Component2 = 0
Component3 = 0
Component4 = 0
Component5 = 0
Component6 = 0
Component7 = 0
Component8 = 0
Component9 = 0
Component10 = 0
Component11 = 0
Component12 = 0
Component13 = 0
SecurityCode = 835
Why is it putting spaces? between each one, Name = Value ; It needs to be... name=value.

In Y_INI how do you stop it using spaces?

pawn Код:
new carfile[64];
        format(carfile, sizeof(carfile),"LARP/Vehicles/%d.ini",idx);
        new INI:cfile = INI_Open(carfile);
        if(fexist(carfile))
        {
            INI_WriteInt(cfile,"Model", CarInfo[idx][cModel]);
            INI_WriteFloat(cfile,"Location_X",CarInfo[idx][cLocationx]);
            INI_WriteFloat(cfile,"Location_Y",CarInfo[idx][cLocationy]);
            INI_WriteFloat(cfile,"Location_Z",CarInfo[idx][cLocationz]);
            INI_WriteFloat(cfile,"Angle",CarInfo[idx][cAngle]);
            INI_WriteInt(cfile,"Color_1",CarInfo[idx][cColorOne]);
            INI_WriteInt(cfile,"Color_2",CarInfo[idx][cColorTwo]);
            INI_WriteString(cfile,"Owner",CarInfo[idx][cOwner]);
            INI_WriteInt(cfile,"Owned",CarInfo[idx][cOwned]);
            INI_WriteInt(cfile,"Locked",CarInfo[idx][cLock]);
            INI_WriteInt(cfile,"Paintjob",CarInfo[idx][cPaintjob]);
            INI_WriteInt(cfile,"VirtualWorld",CarInfo[idx][cVirWorld]);
            INI_WriteInt(cfile,"Component0",CarInfo[idx][cComponent0]);
            INI_WriteInt(cfile,"Component1",CarInfo[idx][cComponent1]);
            INI_WriteInt(cfile,"Component2",CarInfo[idx][cComponent2]);
            INI_WriteInt(cfile,"Component3",CarInfo[idx][cComponent3]);
            INI_WriteInt(cfile,"Component4",CarInfo[idx][cComponent4]);
            INI_WriteInt(cfile,"Component5",CarInfo[idx][cComponent5]);
            INI_WriteInt(cfile,"Component6",CarInfo[idx][cComponent6]);
            INI_WriteInt(cfile,"Component7",CarInfo[idx][cComponent7]);
            INI_WriteInt(cfile,"Component8",CarInfo[idx][cComponent8]);
            INI_WriteInt(cfile,"Component9",CarInfo[idx][cComponent9]);
            INI_WriteInt(cfile,"Component10",CarInfo[idx][cComponent10]);
            INI_WriteInt(cfile,"Component11",CarInfo[idx][cComponent11]);
            INI_WriteInt(cfile,"Component12",CarInfo[idx][cComponent12]);
            INI_WriteInt(cfile,"Component13",CarInfo[idx][cComponent13]);
            INI_WriteInt(cfile,"SecurityCode",CarInfo[idx][cCode]);
            INI_Close(cfile); // Closes the file
Reply
#2

You can't.
Reply
#3

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
You can't.
Ahh right!

What variable in Y_INI uses this:

pawn Код:
strmid(CarInfo[idx][cOwner], dini_Get(clfile,"Owner"), 0, strlen(dini_Get(clfile,"Owner")), 255);
dini_Get - What is that in Y_INI?
Reply
#4

I'm not sure about DINI, but I'm guessing this gets a string? If so, then you'll use: INI_String(name[], variable, length).

If it gets an integer, use: INI_Int(name[], variable).
Reply
#5

pawn Код:
public LoadCar()
{
    for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
    {
        new carfile[64];
        format(carfile, sizeof(carfile),"LARP/Vehicles/%d.ini", idx);
        new INI:clfile = INI_Open(carfile);
        if(fexist(carfile))
        {
            CarInfo[idx][cModel] = INI_Int(clfile,"Model");
            CarInfo[idx][cLocationx] = INI_SetTag(clfile,"Location_X");
            CarInfo[idx][cLocationy] = INI_SetTag(clfile,"Location_Y");
            CarInfo[idx][cLocationz] = INI_SetTag(clfile,"Location_Z");
            CarInfo[idx][cAngle] = INI_SetTag(clfile,"Angle");
            CarInfo[idx][cColorOne] = INI_Int(clfile,"Color_1");
            CarInfo[idx][cColorTwo] = INI_Int(clfile,"Color_2");
            strmid(CarInfo[idx][cOwner], INI_String(clfile,"Owner"), 0, strlen(INI_String(clfile,"Owner")), 255);
            CarInfo[idx][cOwned] = INI_Int(clfile,"Owned");
            CarInfo[idx][cLock] = INI_Int(clfile,"Locked");
            CarInfo[idx][cPaintjob] = INI_Int(clfile,"Paintjob");
            CarInfo[idx][cVirWorld] = INI_Int(clfile,"VirtualWorld");
            CarInfo[idx][cComponent0] = INI_Int(clfile,"Component0");
            CarInfo[idx][cComponent1] = INI_Int(clfile,"Component1");
            CarInfo[idx][cComponent2] = INI_Int(clfile,"Component2");
            CarInfo[idx][cComponent3] = INI_Int(clfile,"Component3");
            CarInfo[idx][cComponent4] = INI_Int(clfile,"Component4");
            CarInfo[idx][cComponent5] = INI_Int(clfile,"Component5");
            CarInfo[idx][cComponent6] = INI_Int(clfile,"Component6");
            CarInfo[idx][cComponent7] = INI_Int(clfile,"Component7");
            CarInfo[idx][cComponent8] = INI_Int(clfile,"Component8");
            CarInfo[idx][cComponent9] = INI_Int(clfile,"Component9");
            CarInfo[idx][cComponent10] = INI_Int(clfile,"Component10");
            CarInfo[idx][cComponent11] = INI_Int(clfile,"Component11");
            CarInfo[idx][cComponent12] = INI_Int(clfile,"Component12");
            CarInfo[idx][cComponent13] = INI_Int(clfile,"Component13");
            CarInfo[idx][cCode] = INI_Int(clfile,"SecurityCode");
            INI_Close(clfile); // Closes the file
        }
    }
    print("[SCRIPT]: Loaded Cars On New System! [Y_INI!]");
    return 1;
}
Pawno Crashes, any idea what I did wrong? Using Y_INI.
Reply
#6

You don't assign variables to Y_INI Functions. Y_INI passes the data to the specified variable, which is:

INI_String(name[], variable, length)

INI_Int(name[], variable)

So this:

pawn Код:
CarInfo[idx][cComponent12] = INI_Int(clfile,"Component12");
Should be:

pawn Код:
INI_Int("Component12",CarInfo[idx][cComponent12]);
Reply
#7

Quote:
Originally Posted by gtakillerIV
Посмотреть сообщение
You don't assign variables to Y_INI Functions. Y_INI passes the data to the specified variable, which is:

INI_String(name[], variable, length)

INI_Int(name[], variable)

So this:

pawn Код:
CarInfo[idx][cComponent12] = INI_Int(clfile,"Component12");
Should be:

pawn Код:
INI_Int("Component12",CarInfo[idx][cComponent12]);
Ahh!!

I'm new to Y_INI! But, thanks! Time for me to convert those.

I'm removing DINI It's too slow for my GM, server keeps lagging out mad
Reply
#8

If you need other help, PM me. Hopefully I'll respond.
Reply
#9

pawn Код:
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22268) : error 017: undefined symbol "name"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22268) : error 017: undefined symbol "value"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22269) : error 017: undefined symbol "name"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22269) : error 017: undefined symbol "value"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22270) : error 017: undefined symbol "name"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22270) : error 017: undefined symbol "value"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22271) : error 017: undefined symbol "name"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22271) : error 017: undefined symbol "value"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22272) : error 017: undefined symbol "name"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22272) : error 017: undefined symbol "value"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22273) : error 017: undefined symbol "name"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22273) : error 017: undefined symbol "value"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22274) : error 017: undefined symbol "name"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22274) : error 017: undefined symbol "value"
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22275) : error 029: invalid expression, assumed zero
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22275) : error 035: argument type mismatch (argument 1)
C:\Users\matt\Desktop\Raven's Roleplay 0.3c\gamemodes\larp.pwn(22275) : error 001: expected token: ";", but found "return"
C:\Users\matt\Desktop\Raven'
s Roleplay 0.3c\gamemodes\larp.pwn(22275) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


18 Errors.
pawn Код:
public LoadCar()
{
    for(new idx = 1; idx < sizeof(CarInfo) ; idx++)
    {
        new carfile[64];
        format(carfile, sizeof(carfile),"LARP/Vehicles/%d.ini", idx);
        new INI:clfile = INI_Open(carfile);
        if(fexist(carfile))
        {
            INI_Int("Model",CarInfo[idx][cModel]);
            INI_Float("Location_X",CarInfo[idx][cLocationx]);
            INI_Float("Location_Y",CarInfo[idx][cLocationy]);
            INI_Float("Location_Z",CarInfo[idx][cLocationz]);
            INI_Float("Angle",CarInfo[idx][cAngle]);
            INI_Int("Color_1",CarInfo[idx][cColorOne]);
            INI_Int("Color_2",CarInfo[idx][cColorTwo]);
            strmid(CarInfo[idx][cOwner], INI_String(clfile,"Owner"), 0, strlen(INI_String(clfile,"Owner")), 255);
            INI_Int("Owned",CarInfo[idx][cOwned]);
            INI_Int("Locked",CarInfo[idx][cLock]);
            INI_Int("VirtualWorld",CarInfo[idx][cVirWorld]);
            INI_Int("Component0",CarInfo[idx][cComponent0]);
            INI_Int("Component1",CarInfo[idx][cComponent1]);
            INI_Int("Component2",CarInfo[idx][cComponent2]);
            INI_Int("Component3",CarInfo[idx][cComponent3]);
            INI_Int("Component4",CarInfo[idx][cComponent4]);
            INI_Int("Component5",CarInfo[idx][cComponent5]);
            INI_Int("Component6",CarInfo[idx][cComponent6]);
            INI_Int("Component7",CarInfo[idx][cComponent7]);
            INI_Int("Component8",CarInfo[idx][cComponent8]);
            INI_Int("Component9",CarInfo[idx][cComponent9]);
            INI_Int("Component10",CarInfo[idx][cComponent10]);
            INI_Int("Component11",CarInfo[idx][cComponent11]);
            INI_Int("Component12",CarInfo[idx][cComponent12]);
            INI_Int("Component13",CarInfo[idx][cComponent13]);
            INI_Int("SecurityCode",CarInfo[idx][cCode]);
            INI_Close(clfile); // Closes the file
        }
    }
    print("[SCRIPT]: Loaded Cars On New System! [Y_INI!]");
    return 1;
}
What bust up their, name/value?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)