dini problems
#1

Right, I am making a new gamemode which will have a dini version and a mysql version which I am planning to release here but I am having a problem scripting the dini version, now I haven't used dini for a while but here's my code.

pawn Код:
forward LoadVehicles();
public LoadVehicles()
{
    new file[128];
    format(file, sizeof(file), "/Vehicles/%d.ini", cars);
    if(!dini_Exists(file))
    {
        VehicleInfo[cars][vModel] = dini_Int(file, "Model");
        VehicleInfo[cars][vPosX] = dini_Float(file, "X");
        VehicleInfo[cars][vPosY] = dini_Float(file, "Y");
        VehicleInfo[cars][vPosZ] = dini_Float(file, "Z");
        VehicleInfo[cars][vPosA] = dini_Float(file, "A");
        VehicleInfo[cars][vColor1] = dini_Int(file, "Color1");
        VehicleInfo[cars][vColor2] = dini_Int(file, "Color2");
        //CreateVehicle(VehicleInfo[cars][vModel], VehicleInfo[cars][vPosX], VehicleInfo[cars][vPosY], VehicleInfo[cars][vPosZ], VehicleInfo[cars][vPosA], VehicleInfo[cars][vColor1], VehicleInfo[cars][vColor1], false);
        CreateVehicle(dini_Int(file, "Model"), dini_Float(file, "X"), dini_Float(file, "Y"), dini_Float(file, "Z"), dini_Float(file, "A"), dini_Int(file, "Color1"), dini_Int(file, "Color2"), false);
    }
    return 1;
}
And here's the global variable for the cars.

pawn Код:
new cars = 0;
Thanks in advance.
Reply
#2

Where have you gotten this from?
Reply
#3

Nowhere, I made it. Why?
Reply
#4

Fixed.
Reply
#5

Thanks, its a lot better than the code I was just using. Now I seem to be having a problem with the Owner variable.

I want it to say this when you enter a vehicle.
If the vehicle is owned by you it should say "INFO: Welcome to your vehicle 'Name'."
And if the vehicle isn't owned by you it should say "INFO: This vehicle is owned by 'Name'."

But unfortunately it does say that but its all wrong, here's my fail code:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
        new file[128], str[128], name[MAX_PLAYER_NAME];
        new vehicleid = GetPlayerVehicleID(playerid);
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), "/Vehicles/%d.ini", vehicleid);
        format(name, sizeof(name), "%s", dini_Get(file, "Owner"));
        foreach(Player, i)
        {
            if(PlayerInfo[i][pCarKey] == vehicleid)
            {
                format(str, sizeof(str), "INFO: This vehicle is owned by %s.", name);
            }
            else if(PlayerInfo[i][pCarKey] != vehicleid)
            {
                format(str, sizeof(str), "INFO: Welcome to your vehicle %s.", name);
            }
            SendClientMessage(playerid, COLOR_YELLOW, str);
        }
    }
    return 1;
}
And heres my variable for vOwner.

pawn Код:
vOwner[MAX_PLAYER_NAME]
Reply
#6

Why Do People Use Dini! It is very slow. Open File... Execute... Close File... ( Repeat for every variable stored/retrieved )
Reply
#7

I am making to versions of this script.. If you look at my signature and if you would actually read the post you would find out..
Reply
#8

Quote:
Originally Posted by AustinJ
Посмотреть сообщение
Why Do People Use Dini! It is very slow. Open File... Execute... Close File... ( Repeat for every variable stored/retrieved )
Nice quote from a thread dude plus if your not to far into making it Y_INI i much easyer to use than dini

You might understand it fully.
Reply
#9

All's I need is for that code to be fixed, I am perfectly fine using dini and mysql, I don't need to learn another file processor yet.
Reply
#10

Anyone?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)