[HELP] Vehicle Components.
#1

Well, I have a question.
I created a dialog which add to the vehicle nitro & hydraulics.
The nitro saved, but the hydraulics didn't save.
Here is the part of the code:
ENUMS:
Код:
enum veh
{
	carmodel,
	Float:fx,
	Float:fy,
	Float:fz,
	Float:fa,
	color1,
	color2,
	respawn,
	carteam,
	cartype, // 0 = driveable by all // 1 family restricted // 2 job restricted // 3 rentable
	modeltype, //0 car // 1 heli // 2 plane // 3 boat
	jobname[20],
	biznumber,
	plate[10],
	tmplocked,
	tmplockedby,
	carowner[MAX_STRING],
	carprice,
	reset,
	Components[CAR_COMPONENTS],
	dupekey[MAX_STRING],
	vw,
	paintjob,
	nitro,
	hydros,

}

new Vehicles[][veh] = {
DIALOG:
Код:
new vid = GetPlayerVehicleID(playerid);
    if(dialogid == 158 && response == 1)
	{
			switch(listitem)
			{
			    case 0:
				{
					dini_Set(CarFile(GetPlayerVehicleID(playerid)), "nitro", "1");
			 		AddVehicleComponent(vid, 1010);
			 		SendClientInfo(playerid, "Nitro added to your vehicle!");
                                        GivePlayerMoneyEx(playerid,-300);
				 	return 1;
				}
			    case 1:
				{
				    dini_Set(CarFile(GetPlayerVehicleID(playerid)), "hydros", "1");
					AddVehicleComponent(vid, 1087);
					SendClientInfo(playerid, "Hydros added to your vehicle!");
					GivePlayerMoneyEx(playerid,-350);
					return 1;
				}
			}


	}
The part that should create the files:
Код:
dini_IntSet(CarFile(i), "nitro", Vehicles[i][nitro]);
dini_IntSet(CarFile(i), "hydros", Vehicles[i][hydros]);
A part of the stock:
Код:
Vehicles[i][nitro] = dini_Int(CarFile(i), "nitro");
Vehicles[i][hydros] = dini_Int(CarFile(i), "hydros");
OnVehicleSpawn:
Код:
if(Vehicles[vehicleid][nitro] > 0)
	{
		AddVehicleComponent(vid, 1010); // Nitro

		return 1;
	}
	if(Vehicles[vehicleid][hydros] > 0)
	{
		AddVehicleComponent(vid, 1087); // Hydros

		return 1;
	}
Reply
#2

You returned (ending) the callback after loading nitro, that's why hydraulic didn't add.
(OnVehicleSpawn)
pawn Код:
if(Vehicles[vehicleid][nitro] > 0)
    {
        AddVehicleComponent(vid, 1010); // Nitro
    }
    if(Vehicles[vehicleid][hydros] > 0)
    {
        AddVehicleComponent(vid, 1087); // Hydros
    }
Reply
#3

Hmm it didn't work. something else?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)