SA-MP Forums Archive
quick vehicel question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: quick vehicel question (/showthread.php?tid=643944)



quick vehicel question - n00blek - 30.10.2017

just made few things and got a quick question
if i want for all vehicles to save their health and fuel on respawn do i need new enum and PATH for Vehicles(using Y_ini)
or what?


Re: quick vehicel question - kingmk - 30.10.2017

You can do so:

Код:
#define MAX_VEHS 50 // number of vehicle you want to load from your database.
enum E_VEHICLES
{
      vID,
      vModel,
      .....
      .....
      other staffs vars
      ....
      vFuel,
      vHeal
}
new VehicleInfo[MAX_VEHS][E_VEHICLES];


forward LoadVehicle();
public LoadVehicle();
{
    //Here you load your info from your database using vars from E_VEHICLES enum. Ex: VehicleInfo[v][vHeal] = ....;
    return 1;
}

public OnGamemodeInit()
{
     //Here you made the connection of your database.

     //Here you load vehicle infos.
     LoadVehicle();
     return 1;
}
public OnVehicleSpawn(vehicleid)
{
     new Float: vHP;
     GetVehicleHealth(vehicleid, vHP)
     ....other staffs....
     VehicleInfo[vehicleid][vHeal] = vHP;
     return 1;
}



Re: quick vehicel question - n00blek - 01.11.2017

Tnx bro.
Btw i know how to make enums i made 5 of those xD.
I just ask do i need to make another one bcz i didnt need it until now. Xd thanks
+rep