Vehicle Sys..
#1

Okay, the saving now works, It is just the loading, This is was is causing the "World Boundaries" bug;

The Saving
pawn Код:
if(strcmp(cmdtext, "/savevehicles", true) == 0)
    { //Saves ALL vehicles. There you go, ELuisabiatch. I hope this meets your needs, I can't be too sure tho, I no haef source so no testing -.-
        new file[128], Float:Pos[4], vehModel, Plate, str[128], Type;
        new vehicleid = GetPlayerVehicleID(playerid);
        //if(PlayerInfo[playerid][pAdmin] <  10 && !IsPlayerAdmin(playerid)) return 1;
        for(new i = 1; i<=MAX_CARS; i++)
        {
            if(!GetVehicleModel(i)) return 1;
            format(file, sizeof(file), "Vehicles/%d.ini", i);
            if(!dini_Exists(file))
            {
                dini_Create(file);
                printf("Vehicle ID %d file created", i);
            }
            GetVehiclePos(vehicleid, Pos[0], Pos[1], Pos[2]);
            GetVehicleZAngle(vehicleid, Pos[3]);
            vehModel = GetVehicleModel(i);
            //dini_Create(file);
            dini_IntSet(file, "Model", vehModel);
            dini_FloatSet(file, "PosX", Pos[0]);
            dini_FloatSet(file, "PosY", Pos[1]);
            dini_FloatSet(file, "PosZ", Pos[2]);
            dini_FloatSet(file, "PosA", Pos[3]);
            //dini_Set(file, "Plate", Plate);
            dini_IntSet(file, "Type", Type);

            printf("Vehicle ID %d saved", i);
            format(str, sizeof(str), "DEBUG: Vehicle ID %d saved", i);
            SendClientMessage(playerid, COLOR_YELLOW, str);
            print("Debug Message: Saving Vehicles is Good!");
            //break;
        }
        return 1;
    }
The Loading
Now, I want the Loading to be perfect just like the Saving.
pawn Код:
forward LoadVehicle();
public LoadVehicle()
{
    new file[128], Model, Veh, Float:Pos[4];
    for(new i = 1; i<=MAX_CARS; i++)
    {
        format(file, sizeof(file), "Vehicles/%d.ini", i);
        if(dini_Exists(file))
        {
            Model = dini_Int(file, "Model");
            Pos[0] = dini_Int(file, "VehX");
            Pos[1] = dini_Int(file, "VehY");
            Pos[2] = dini_Int(file, "VehZ");
            Pos[3] = dini_Int(file, "VehA");
            Veh = CreateVehicle(Model, Pos[0], Pos[1], Pos[2], Pos[3], 1, 1, 1000);
            VehicleInfo[i][vModel] = Model;
            VehicleInfo[i][vX] = Pos[0];
            VehicleInfo[i][vY] = Pos[1];
            VehicleInfo[i][vZ] = Pos[2];
            VehicleInfo[i][vA] = Pos[3];
        }
        //CreateVehicle(VehicleInfo[i][vModel], VehicleInfo[i][vX], VehicleInfo[i][vY], VehicleInfo[i][vZ], VehicleInfo[i][vA], 1, 1, false);
    }
    print("Debug Message: Loading Vehicles is Good!");
    return 1;
}
I know it is a mess, But I am still an Amateur with Scripting so I am sorry about that.
Reply


Messages In This Thread
Vehicle Sys.. - by Luis- - 30.01.2011, 23:09
Re: Vehicle Sys.. - by DRIFT_HUNTER - 31.01.2011, 00:08

Forum Jump:


Users browsing this thread: 3 Guest(s)