14.05.2016, 14:43
Hello everyone i am trying to save my vehicle mods when i mod it in modshop but the problem is in ini file it shows the mod value to 0
here is my code:
when server shuts down under "FilterscriptExit"
but this is what i get in ini file after closing the server:
here is my code:
PHP код:
public OnVehicleMod(playerid, vehicleid, componentid)
{
SaveVehMods(vehicleid, componentid);
return 1;
}
PHP код:
stock SaveVehMods(vehicleid, componentid)
{
for(new s=0; s<20; s++)
{
if(componentid == spoiler[s][0])
{
VehicleInfo[vehicleid][vMods][0] = componentid;
}
}
for(new s=0; s<4; s++) {
if(componentid == bscoop[s][0]) {
VehicleInfo[vehicleid][vMods][1] = componentid;
}
}
for(new s=0; s<17; s++) {
if(componentid == rscoop[s][0]) {
VehicleInfo[vehicleid][vMods][2] = componentid;
}
}
for(new s=0; s<21; s++) {
if(componentid == rskirt[s][0]) {
VehicleInfo[vehicleid][vMods][3] = componentid;
}
}
for(new s=0; s<21; s++) {
if(componentid == lskirt[s][0]) {
VehicleInfo[vehicleid][vMods][16] = componentid;
}
}
for(new s=0; s<2; s++) {
if(componentid == light[s][0]) {
VehicleInfo[vehicleid][vMods][4] = componentid;
}
}
for(new s=0; s<3; s++) {
if(componentid == nitro[s][0]) {
VehicleInfo[vehicleid][vMods][5] = componentid;
}
}
for(new s=0; s<28; s++) {
if(componentid == exhaust[s][0]) {
VehicleInfo[vehicleid][vMods][6] = componentid;
}
}
for(new s=0; s<17; s++) {
if(componentid == wheels[s][0]) {
VehicleInfo[vehicleid][vMods][7] = componentid;
}
}
for(new s=0; s<1; s++) {
if(componentid == bas[s][0]) {
VehicleInfo[vehicleid][vMods][8] = componentid;
}
}
for(new s=0; s<1; s++) {
if(componentid == hydraulics[s][0]) {
VehicleInfo[vehicleid][vMods][9] = componentid;
}
}
for(new s=0; s<23; s++) {
if(componentid == fbumper[s][0]) {
VehicleInfo[vehicleid][vMods][10] = componentid;
}
}
for(new s=0; s<22; s++) {
if(componentid == rbumper[s][0]) {
VehicleInfo[vehicleid][vMods][11] = componentid;
}
}
for(new s=0; s<2; s++) {
if(componentid == bventr[s][0]) {
VehicleInfo[vehicleid][vMods][12] = componentid;
}
}
for(new s=0; s<2; s++) {
if(componentid == bventl[s][0]) {
VehicleInfo[vehicleid][vMods][13] = componentid;
}
}
for(new s=0; s<2; s++) {
if(componentid == fbbars[s][0]) {
VehicleInfo[vehicleid][vMods][15] = componentid;
}
}
for(new s=0; s<4; s++) {
if(componentid == rbbars[s][0]) {
VehicleInfo[vehicleid][vMods][14] = componentid;
}
}
}
PHP код:
stock SaveVehicles(id)
{
new file[64];
format(file, sizeof(file), "Vehicles/%d.ini", id);
new INI:Handle = INI_Open(file);
if(Handle != INI_NO_FILE)
{
INI_WriteInt(Handle, "VehMod1", VehicleInfo[id][vMods][0]);
INI_WriteInt(Handle, "VehMod2", VehicleInfo[id][vMods][1]);
INI_WriteInt(Handle, "VehMod3", VehicleInfo[id][vMods][2]);
INI_WriteInt(Handle, "VehMod4", VehicleInfo[id][vMods][3]);
INI_WriteInt(Handle, "VehMod5", VehicleInfo[id][vMods][4]);
INI_WriteInt(Handle, "VehMod6", VehicleInfo[id][vMods][5]);
INI_WriteInt(Handle, "VehMod7", VehicleInfo[id][vMods][6]);
INI_WriteInt(Handle, "VehMod8", VehicleInfo[id][vMods][7]);
INI_WriteInt(Handle, "VehMod9", VehicleInfo[id][vMods][8]);
INI_WriteInt(Handle, "VehMod10", VehicleInfo[id][vMods][9]);
INI_WriteInt(Handle, "VehMod11", VehicleInfo[id][vMods][10]);
INI_WriteInt(Handle, "VehMod12", VehicleInfo[id][vMods][11]);
INI_WriteInt(Handle, "VehMod13", VehicleInfo[id][vMods][12]);
INI_WriteInt(Handle, "VehMod14", VehicleInfo[id][vMods][13]);
INI_WriteInt(Handle, "VehMod15", VehicleInfo[id][vMods][14]);
INI_WriteInt(Handle, "VehMod16", VehicleInfo[id][vMods][15]);
INI_WriteInt(Handle, "VehMod17", VehicleInfo[id][vMods][16]);
INI_Close(Handle);
}
}
Код:
VehMod1 = 0 VehMod2 = 0 VehMod3 = 0 VehMod4 = 0 VehMod5 = 0 VehMod6 = 0 VehMod7 = 0 VehMod8 = 0 VehMod9 = 0 VehMod10 = 0 VehMod11 = 0 VehMod12 = 0 VehMod13 = 0 VehMod14 = 0 VehMod15 = 0 VehMod16 = 0 VehMod17 = 0