Lloyd Logan Posted January 27, 2013 Posted January 27, 2013 Hey, is this piece of code correct? local health = getElementHealth( thePlayer ) if (health=<50) then I am not sure about the second line? WHat the layout of that should be? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Lloyd Logan Posted January 27, 2013 Author Posted January 27, 2013 Perfect! How would i get the health of a vehicle! Thanks If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
TAPL Posted January 27, 2013 Posted January 27, 2013 Perfect! How would i get the health of a vehicle!Thanks getElementHealth: This function returns the current health for the specified element. This can be a player, a ped, or a vehicle.
Lloyd Logan Posted January 27, 2013 Author Posted January 27, 2013 Perfect! How would i get the health of a vehicle!Thanks getElementHealth: This function returns the current health for the specified element. This can be a player, a ped, or a vehicle. I done this but it always says Your car is fine? even if my car is on fire. function healthin( thePlayer ) local vehiclee = getPedOccupiedVehicle( thePlayer ) if vehiclee then local health = getElementHealth( vehiclee ) if (health<=50) then outputChatBox("Time For a repair!", thePlayer) else outputChatBox("Your car is fine!", thePlayer) end else outputChatBox("You're not in a vehicle!", thePlayer) end end addCommandHandler("carh", healthin) If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
DNL291 Posted January 27, 2013 Posted January 27, 2013 function healthin( thePlayer ) local vehiclee = getPedOccupiedVehicle( thePlayer ) if vehiclee then local health = getElementHealth( vehiclee ) if (health<=500) then outputChatBox("Time For a repair!", thePlayer) else outputChatBox("Your car is fine!", thePlayer) end else outputChatBox("You're not in a vehicle!", thePlayer) end end addCommandHandler("carh", healthin) Please do not PM me with scripting related question nor support, use the forums instead.
Lloyd Logan Posted January 27, 2013 Author Posted January 27, 2013 Thanks, is health out of 1000? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Castillo Posted January 27, 2013 Posted January 27, 2013 Max vehicle health is 1000%. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Lloyd Logan Posted January 27, 2013 Author Posted January 27, 2013 Max vehicle health is 1000%. Is there anyway to change the health value to 100 instead of 1000, so it would be /setcarhp 100? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
TAPL Posted January 27, 2013 Posted January 27, 2013 Max vehicle health is 1000%. Is there anyway to change the health value to 100 instead of 1000, so it would be /setcarhp 100? With math you can do it: 10*100 will do the job.
Lloyd Logan Posted January 27, 2013 Author Posted January 27, 2013 Max vehicle health is 1000%. Is there anyway to change the health value to 100 instead of 1000, so it would be /setcarhp 100? With math you can do it: 10*100 will do the job. So, calculate in my script, that if a player enters /setcarhp 100, just multiply the 100 by 10?, and if so, how would I do this? If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Castillo Posted January 27, 2013 Posted January 27, 2013 Yes, that's right. setElementHealth ( theVehicle, amount * 10 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
TAPL Posted January 27, 2013 Posted January 27, 2013 Don't forget to use tonumber when you use addCommandHandler, because the argument will be in string.
Lloyd Logan Posted January 27, 2013 Author Posted January 27, 2013 Thanks guys!! If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE SCOTLAND, my hometown, and the Home of GTA!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now