View Single Post
Old 07/07/2020, 03:41 PM   #1
supermember
Big Clucker
 
Join Date: May 2012
Posts: 95
Reputation: 0
Wink 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://forum.sa-mp.com/showthread.php?t=676775
supermember is offline   Reply With Quote