[Tutorial] Wreck Car After Respawn [Easily]

Started by SA:MP, May 05, 2023, 05:48 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

SA:MP

[Tutorial] Wreck Car After Respawn [Easily]

I am New developer, And I have Low skill for sa-mp.

[I am weak english]



I am open a server for real life. But sometimes players often seize the opportunity to Spawn car, such as Drive the car fall water without Mechanic's repair. I try to fix this problems but I am new developer [weak developer]



First : I try to make Save health's Car into Mysql but I can't make it.

Second : I am think to easy make and I tried not related to the database.



Yep! I choose the second method.  and I think it basic for all gamemode.



Begin : make it


Code:

new Float:VehicleDamage[MAX_VEHICLES];

Next : Find to : public OnVehicleDeath(vehicleid)

Describe : When The Vehicle was damage by something such as Fall the water, Weapon or Crash

It's Check = 1.

Type :


Code:

VehicleDamage[vehicleid] = 1;

Next : Find public OnVehicleSpawn(vehicleid)

Describe : If the vehicledamage = 1 ,  It will determine what the vehicle will look like.

TYPE:


Code:

if(VehicleDamage[vehicleid] == 1)
    {
UpdateVehicleDamageStatus(vehicleid, panels, doors, lights, 15);//If want to Show look the car's damage
        SetVehicleHealth(vehicleid, 300);//Set Health After Respawn
        VehicleDamage[vehicleid] = 0; // Back Check this car to 0
    }

This is working, But If you're Restart Server Or Vehicle's Respawn. The Car is comeback to Full hp.

-----------------------------------------------------------------------------------------------------------------



I developed knowledge from...



Credit : SharpenBlade

https://sampforum.blast.hk/showthread.php?tid=676775

Source: [Tutorial] Wreck Car After Respawn [Easily]