Sorry.
#1

Well, I am still making a Vehicle System and I am having the same problem as before but this is Saving;

pawn Код:
if(strcmp(cmdtext, "/savev", true) == 0)
    {
        new file[128];
        new vehicle = GetPlayerVehicleID(playerid);
        new Float:X,Float:Y,Float:Z,Float:A;
        for(new v = 0; v<MAX_CARS; v++)
        {
            GetPlayerPos(playerid, X,Y,Z);
            GetPlayerFacingAngle(playerid, A);
            format(file, sizeof(file), "Vehicles/%d.ini", v);
            GetPlayerPos(playerid, X, Y, Z);
            GetPlayerFacingAngle(playerid, A);
            VehicleInfo[v][vModel] = vehicle;
            VehicleInfo[v][vX] = X;
            VehicleInfo[v][vY] = Y;
            VehicleInfo[v][vZ] = Z;
            VehicleInfo[v][vA] = A;
            if(!dini_Exists(file))
            {
                dini_Create(file);
                dini_IntSet(file, "Model", VehicleInfo[vehicle][vModel]);
                dini_FloatSet(file, "VehX", VehicleInfo[vehicle][vX]);
                dini_FloatSet(file, "VehY", VehicleInfo[vehicle][vY]);
                dini_FloatSet(file, "VehZ", VehicleInfo[vehicle][vZ]);
                dini_FloatSet(file, "VehA", VehicleInfo[vehicle][vA]);
            }
            print("Saved!");
        }
        return 1;
    }
If you could tell me how to fix this I would be eternily greatful.

The command is just saying "SERVER: Unknown Command." but I don't see what is wrong.

I would also appreciate it if someone could tell me how to propaly save the Vehicle's ID for example, Infernus's ID is 411 so I would want to save the 411 in to VehicleInfo[vehicle][vModel].

Cheers.
Reply
#2

pawn Код:
new vehicle = GetVehicleModel(GetPlayerVehicleID(playerid));
Try that, although i had this problem before and i just dont remember what i've done to fix it >.<
Reply
#3

You're using 'v' for max_cars, but at the same time, you're trying to save from 'vehicleid' which has nothing to do with 'v'. Why don't you just use ONE variable.
Reply
#4

What are you doing here:
pawn Код:
VehicleInfo[v][vModel] = vehicle;
            VehicleInfo[v][vX] = X;
            VehicleInfo[v][vY] = Y;
            VehicleInfo[v][vZ] = Z;
            VehicleInfo[v][vA] = A;
            if(!dini_Exists(file))
            {
                dini_Create(file);
                dini_IntSet(file, "Model", VehicleInfo[vehicle][vModel]);
                dini_FloatSet(file, "VehX", VehicleInfo[vehicle][vX]);
                dini_FloatSet(file, "VehY", VehicleInfo[vehicle][vY]);
                dini_FloatSet(file, "VehZ", VehicleInfo[vehicle][vZ]);
                dini_FloatSet(file, "VehA", VehicleInfo[vehicle][vA]);
            }
You're setting the Model slot to variable "vehicle", then you're saving arrays by this "vehicle" variable. What this is doing is saving information per vehicle model, not vehicleid. Replace all the "vehicle" with "v" since thats what your loop is running through.

pawn Код:
VehicleInfo[v][vModel] = vehicle;
            VehicleInfo[v][vX] = X;
            VehicleInfo[v][vY] = Y;
            VehicleInfo[v][vZ] = Z;
            VehicleInfo[v][vA] = A;
            if(!dini_Exists(file))
            {
                dini_Create(file);
                dini_IntSet(file, "Model", VehicleInfo[v][vModel]);
                dini_FloatSet(file, "VehX", VehicleInfo[v][vX]);
                dini_FloatSet(file, "VehY", VehicleInfo[v][vY]);
                dini_FloatSet(file, "VehZ", VehicleInfo[v][vZ]);
                dini_FloatSet(file, "VehA", VehicleInfo[v][vA]);
            }
Reply
#5

Thanks, But now my loop is just spamming my Vehicles Folder with the Same Vehicle.., How can I stop this?
Reply
#6

Are any of the vehicle files accurate? Or are they ALL the same?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)