Saving vehicle is creating 1999 files instead of one.
#1

Hello, yeah I tried making a vehicle saving system. This is my first attempt:

pawn Код:
command(savevehicle, playerid, params[])
{
    if(PlayerInfo[playerid][Admin] >= 4)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vehicle, Float:vx, Float:vy, Float:vz, Float:vr;
            GetPlayerPos(playerid, vx, vy, vz );
            GetPlayerFacingAngle(playerid, vr);
            vehicle = GetPlayerVehicleID(playerid);
            for(new i = 0; i < MAX_VEHICLES; i++)
            {
                new Vehiclefile[256];
                format(Vehiclefile, sizeof(Vehiclefile), "vehicles/Vehicle_%d.ini", i);
                dini_Create(Vehiclefile);
                {
                    dini_IntSet(Vehiclefile, "VID", vehicle);
                    dini_FloatSet(Vehiclefile, "Posvx", Float:vx);
                    dini_FloatSet(Vehiclefile, "Posvy", Float:vy);
                    dini_FloatSet(Vehiclefile, "Posvz", Float:vz);
                    dini_FloatSet(Vehiclefile, "Posvr", Float:vr);
                    dini_IntSet(Vehiclefile, "FactionID", 0);
                    SendClientMessage(playerid, COLOUR_ADMIN, "[ADMIN NOTE] You have successfully saved the vehicle. /vfaction to change car faction." );
                    SpawnedVehicles++;
                }
            }
        }
    }
    return 1;
}
But the problem is that it keeps creating the same file 1999 times, the Max vehicle limit. Can someone help?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)