Hey guys, I'm trying to make when the vehicle is created, it would start from 1 (example, 1.ini, 2.ini and so on) and not from 0.
Код:
CMD:createveh(playerid, params[])
{
new Float: pos[4], name[MAX_PLAYER_NAME], model, type, siren, plate = random(1000 + 2500), newveh[MAX_PLAYERS], pstr[30], str[180];
new col[2], faction;
new v = GetFreeVehicleID();
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
GetPlayerFacingAngle(playerid, pos[3]);
if(pInfo[playerid][Admin] < 4) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: You need to be an admin in order to do this command!");
if(sscanf(params, "iiiiii", model, type, faction, col[0], col[1], siren)) return SendClientMessage(playerid, -1, "{8EB2D6}[INFO]{FFFFFF}: /createveh [veh] [type] [faction id] [col] [col] [siren(0/1)]");
format(name, sizeof(name), "None");
new INI:File = INI_Open(VehiclePath(v));
INI_SetTag(File, "Vehicle Data");
INI_WriteString(File, "Owner", name);
vInfo[v][Owner] = name;
INI_WriteInt(File, "Model", model);
vInfo[v][Model] = model;
INI_WriteInt(File, "Type", type);
vInfo[v][Type] = type;
INI_WriteInt(File, "Faction", faction);
vInfo[v][Faction] = faction;
INI_WriteFloat(File, "xPos", pos[0]);
vInfo[v][xPos] = pos[0];
INI_WriteFloat(File, "yPos", pos[1]);
vInfo[v][yPos] = pos[1];
INI_WriteFloat(File, "zPos", pos[2]);
vInfo[v][zPos] = pos[2];
INI_WriteFloat(File, "aPos", pos[3]);
vInfo[v][aPos] = pos[3];
INI_WriteFloat(File, "ColorA", col[0]);
vInfo[v][ColorA] = col[0];
INI_WriteFloat(File, "ColorB", col[1]);
vInfo[v][ColorB] = col[1];
INI_WriteInt(File, "Price", 0);
vInfo[v][Price] = 0;
INI_WriteInt(File, "Plate", plate);
vInfo[v][Plate] = plate;
INI_WriteInt(File, "Fuel", 100);
vInfo[v][Fuel] = 100;
INI_WriteInt(File, "Siren", siren);
vInfo[v][Siren] = siren;
INI_WriteInt(File, "StoredSlot1", 0);
vInfo[v][StoredSlot1] = 0;
INI_WriteInt(File, "StoredSlot1Ammo", 0);
vInfo[v][StoredSlot1Ammo] = 0;
INI_WriteInt(File, "StoredSlot2", 0);
vInfo[v][StoredSlot2] = 0;
INI_WriteInt(File, "StoredSlot2Ammo", 0);
vInfo[v][StoredSlot2Ammo] = 0;
INI_Close(File);
format(pstr, sizeof(pstr), "SA %d", vInfo[v][Plate]);
newveh[playerid] = CreateVehicle(model, pos[0], pos[1], pos[2], pos[3], col[0], col[1], 6500, siren);
SetVehicleNumberPlate(newveh[playerid], pstr);
SetVehicleToRespawn(newveh[playerid]);
PutPlayerInVehicle(playerid, newveh[playerid], 0);
format(str, sizeof(str), "{8EB2D6}SERVER:{FFFFFF} You have created a vehicle [Veh: %d | Type: %d | Faction: %d | Color: %d | Color: %d | Siren: %d]", model, type, faction, col[0], col[1], siren);
SendClientMessage(playerid, -1, str);
SaveVehicles();
return true;
}
Your loop( function starting from 0 which I think you used to loop players with it, so try this sir