Loading vehicle (INI_ParseFile)
#1

pawn Код:
stock LoadPVehicles()
{
    for(new i = 0; i < MAX_BUYABLE_VEH; i++)
    {
        INI_ParseFile(VehicleFile(i), "LoadPlayerVehicle", .bExtra = false);
    }
    return true;
}

forward LoadPlayerVehicle(playerid, name[], value[]);
public LoadPlayerVehicle(playerid, name[], value[])
{
    for(new i = 0; i < MAX_BUYABLE_VEH; i++)
    {
        if(!strcmp(name, "Model"))      vInfo[i][vModel]    = strval(value);
        if(!strcmp(name, "Color1"))     vInfo[i][vColor1]   = strval(value);
        if(!strcmp(name, "Color2"))     vInfo[i][vColor2]   = strval(value);
        if(!strcmp(name, "Price"))      vInfo[i][vPrice]    = strval(value);
        if(!strcmp(name, "Owner"))      SetName(vInfo[i][vOwner], value);
        if(!strcmp(name, "vPosX"))      vInfo[i][vPosX]     = floatstr(value);
        if(!strcmp(name, "vPosY"))      vInfo[i][vPosY]     = floatstr(value);
        if(!strcmp(name, "vPosZ"))      vInfo[i][vPosZ]     = floatstr(value);
        if(!strcmp(name, "vPosA"))      vInfo[i][vPosA]     = floatstr(value);
        if(!strcmp(name, "Plate"))      SetName(vInfo[i][vPlate], value);
        if(!strcmp(name, "PaintJ"))     vInfo[i][vPaintJ]   = strval(value);
        if(!strcmp(name, "Locked"))     vInfo[i][vLocked]   = strval(value);

        // Components loading.
        for(new iMod = 0; iMod < MAX_VEH_MODS; iMod++)
        {
            new string[32];
            format(string, sizeof(string), "vMod%d", iMod);
            if(!strcmp(name, string))SetPVarString(playerid, string, vMods[i][iMod]);
        }

        new vCarID = CreateVehicle(vInfo[i][vModel], vInfo[i][vPosX], vInfo[i][vPosY], vInfo[i][vPosZ], vInfo[i][vPosA], vInfo[i][vColor1], vInfo[i][vColor2], 500000);
        SetVehicleNumberPlate(vCarID, vInfo[i][vPlate]);
        ChangeVehiclePaintjob(vCarID, vInfo[i][vPaintJ]);

        // Components adding.
        for(new iMod = 0; iMod < MAX_VEH_MODS; ++iMod)
        {
            if(vMods[vCarID][iMod] > 0)
            {
                AddVehicleComponent(vCarID, vMods[vCarID][iMod]);
            }
        }

        OwnedVeh(vCarID) = i;
        Total_Veh_Created++;
        printf("[VehSystem] A total of: \"%d\" vehicle(s) were loaded!", Total_Veh_Created);
    }
    return true;
}
Not creating, vehicle.. obviously.. not reading INI_ParseFile, not obviously where's an error for me. I don't know i've a problem with loading files like that using Y_Ini, but i prefer this saving/loading type.

Thank you, guys!
Reply


Messages In This Thread
Loading vehicle (INI_ParseFile) - by Riddick94 - 05.08.2012, 18:54
Re: Loading vehicle (INI_ParseFile) - by ReVo_ - 05.08.2012, 19:22
Re: Loading vehicle (INI_ParseFile) - by Riddick94 - 05.08.2012, 19:35
Re: Loading vehicle (INI_ParseFile) - by Riddick94 - 05.08.2012, 20:16
Re: Loading vehicle (INI_ParseFile) - by Arca - 05.08.2012, 20:22
Re: Loading vehicle (INI_ParseFile) - by Riddick94 - 05.08.2012, 20:31
Re: Loading vehicle (INI_ParseFile) - by Arca - 06.08.2012, 00:02
Re: Loading vehicle (INI_ParseFile) - by Riddick94 - 06.08.2012, 08:40
Re: Loading vehicle (INI_ParseFile) - by Riddick94 - 06.08.2012, 09:52
Re: Loading vehicle (INI_ParseFile) - by Riddick94 - 06.08.2012, 14:39

Forum Jump:


Users browsing this thread: 1 Guest(s)