07.03.2015, 10:53
@PaSaSaP:
About inheriting from SA-MP# classes:
It works like this:
In SA-MP# there is a register with types to use when initializing objects for specific handles(e.g. vehicles)
When an event gets called with a vehicleid, it will, by default, initialize a GtaVehicle instance (if not was made with the specified handle earlier) and use that as a vehicle. If you want to create your own vehicle class, you need to tell SA-MP# to use that type instead. Here's how:
Create your Vehicle class:
Create a VehicleController class, in which you tell SA-MP# to use your Vehicle class:
Register the controller to SA-MP#; In your gamemode class:
It works the same for player classes, object classes and so on.
About mysql, personally, I use NHibernate. Its a very nice ORM system. An example can be found here:
https://github.com/ikkentim/SampShar...NHibernateTest
About inheriting from SA-MP# classes:
It works like this:
In SA-MP# there is a register with types to use when initializing objects for specific handles(e.g. vehicles)
When an event gets called with a vehicleid, it will, by default, initialize a GtaVehicle instance (if not was made with the specified handle earlier) and use that as a vehicle. If you want to create your own vehicle class, you need to tell SA-MP# to use that type instead. Here's how:
Create your Vehicle class:
Код:
public class Vehicle: GtaVehicle
{
public Vehicle(int id) : base(id)
{
}
}
Код:
public class VehicleController : GtaVehicleController
{
public override void RegisterTypes()
{
Vehicle.Register<Vehicle>();
}
}
Код:
protected override void LoadControllers(ControllerCollection controllers)
{
base.LoadControllers(controllers);
controllers.Remove<GtaVehicleController>();
controllers.Add(new VehicleController());
}
About mysql, personally, I use NHibernate. Its a very nice ORM system. An example can be found here:
https://github.com/ikkentim/SampShar...NHibernateTest

