System of fires for the vehicles
#1

Hello SAMP's community, it wanted to ask for help to a system that I want to create for my server RolePlay. The system consists of that the vehicles catch fire, that is to say, when a vehicle comes to a certain life (350 for example) or when there starts going out black smoke, which catches fire but which the vehicle does not exploit, in order that the firemen could go and to extinguish it. Only I want to create the system of fires in the vehicles, the firemen's faction already I have her created.

Thank you.
Reply
#2

Hi Cristian,

Assuming you already have some kind of enumerator for your vehicle, my suggestion would be to create an enum - lets say VehicleStatus.

So, on your command to turn on engine - firstly you want to do an If Statement saying if VehicleStatus == 1, do not let the player turn their vehicle on (as it would be on fire).

Make sure that you have, in your enum, the following:
VehicleStatus
PosX
PosY
PosZ
VehicleFireHealth

Your best bet would be to use the OnPlayerTakeDamage function, and check if the Vehicle Health >= 350. If so, get the PosX;PosY;PosZ of the vehicle and create an object on the vehicle. (3461 has flames and is probably a good start)

Now you have the object created, on the vehicle. Set the VehicleFireHealth to a number of your choice, and this will be how /large/ the fire is.

From there, we need to establish how to put out the fire. My recommendation is to use the OnPlayerKeyChange function, and check if the Fire Key is pressed and weapon id == fire extuingisher, get the nearest Vehicle Fire and VehicleFireHealth[VehicleID] -= 5 each time the key is pressed.

Once we have got that functionality in, we can look further into players losing health if closer to the fire. For now, give that a shot and let me know if you have any questions.
Reply
#3

Thank you, I will try to do it to seeing if it goes out for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)