gerlachmax123 Posted February 3, 2013 Posted February 3, 2013 How I can check the Vehicle Health? I have it serverside online but getElementHealth must be clientside function reparierungszieltut(thePlayer) if ( getElementHealth(pruefungsrepVehicle) == 800 ) then outputChatBox ( "Nice Job!", player, 125, 0, 0 ) destroyElement(pruefungsrepVehicle) setElementPosition ( player, 1172.158, 1350.906, 10.922 ) setElementDimension ( player, 0 ) end end Pleas help me.
Fury Posted February 3, 2013 Posted February 3, 2013 client; function getVehHealt() getElementHealth ( getPedOccupiedVehicle ( getLocalPlayer() ) end server; function getVehHealt() getElementHealth ( getPedOccupiedVehicle ( source ) end
gerlachmax123 Posted February 3, 2013 Author Posted February 3, 2013 function getVehHealt() getElementHealth ( getPedOccupiedVehicle ( pruefungsrepVehicle ) end so? i need it serverside...
Puma Posted February 3, 2013 Posted February 3, 2013 Read this page: https://wiki.multitheftauto.com/wiki/GetElementHealth
gerlachmax123 Posted February 3, 2013 Author Posted February 3, 2013 I know, but i need getElementHealth serverside
TAPL Posted February 3, 2013 Posted February 3, 2013 I know, but i need getElementHealth serverside getElementHealth is client side and server side. How about tell us what you are trying to do so we can help you?
gerlachmax123 Posted February 3, 2013 Author Posted February 3, 2013 function reparierungszieltut(thePlayer) if ( getElementHealth(pruefungsrepVehicle) == 800 ) then outputChatBox ( "Nice Job!", player, 125, 0, 0 ) destroyElement(pruefungsrepVehicle) setElementPosition ( player, 1172.158, 1350.906, 10.922 ) setElementDimension ( player, 0 ) end end Ok, when the car (pruefungsrepVehicle) set on 800 then outputChatBox ( "Nice Job!", player, 125, 0, 0 ) But it will come not ....
TAPL Posted February 3, 2013 Posted February 3, 2013 function reparierungszieltut(thePlayer) if ( getElementHealth(pruefungsrepVehicle) == 800 ) then outputChatBox ( "Nice Job!", player, 125, 0, 0 ) destroyElement(pruefungsrepVehicle) setElementPosition ( player, 1172.158, 1350.906, 10.922 ) setElementDimension ( player, 0 ) end end Ok, when the car (pruefungsrepVehicle) set on 800 then outputChatBox ( "Nice Job!", player, 125, 0, 0 ) But it will come not .... Where is the event or whatever the way you calling the function reparierungszieltut?
Fury Posted February 3, 2013 Posted February 3, 2013 function reparierungszieltut(thePlayer) if ( getElementHealth(pruefungsrepVehicle) == 800 ) then outputChatBox ( "Nice Job!", player, 125, 0, 0 ) destroyElement(pruefungsrepVehicle) setElementPosition ( player, 1172.158, 1350.906, 10.922 ) setElementDimension ( player, 0 ) end end Ok, when the car (pruefungsrepVehicle) set on 800 then outputChatBox ( "Nice Job!", player, 125, 0, 0 ) But it will come not .... Where is the event or whatever the way you calling the function reparierungszieltut? he can use timer to check that.
Fury Posted February 3, 2013 Posted February 3, 2013 (edited) how? function reparierungszieltut() if ( getElementHealth ( getPedOccupiedVehicle ( source ) ) == 800 ) then -- your code goes here end end setTimer ( reparierungszieltut, 1000, 0 ) this check player's healt in every 1 second. Edited February 3, 2013 by Guest
gerlachmax123 Posted February 3, 2013 Author Posted February 3, 2013 Can i change the "source" to "pruefungsrepVehicle" ?
Fury Posted February 3, 2013 Posted February 3, 2013 Can i change the "source" to "pruefungsrepVehicle" ? you can; function reparierungszieltut(pruefungsrepVehicle) if ( getElementHealth ( getPedOccupiedVehicle ( pruefungsrepVehicle ) ) == 800 ) then -- your code goes here end end setTimer ( reparierungszieltut, 1000, 0 )
gerlachmax123 Posted February 3, 2013 Author Posted February 3, 2013 function reparierungszieltut(pruefungsrepVehicle) if ( getElementHealth ( getPedOccupiedVehicle ( pruefungsrepVehicle ) ) == 800 ) then -- your code goes here end end setTimer ( reparierungszieltut, 1000, 0 ) This works serverside?
Fury Posted February 3, 2013 Posted February 3, 2013 function reparierungszieltut(pruefungsrepVehicle) if ( getElementHealth ( getPedOccupiedVehicle ( pruefungsrepVehicle ) ) == 800 ) then -- your code goes here end end setTimer ( reparierungszieltut, 1000, 0 ) This works serverside? yes, its for server-side.
Anderl Posted February 3, 2013 Posted February 3, 2013 The code is wrong. The function has one parameter, but setTimer doesn't pass any to it.
Fury Posted February 3, 2013 Posted February 3, 2013 The code is wrong. The function has one parameter, but setTimer doesn't pass any to it. i used setTimer with that way a lot of time. not got any error at debug.
Anderl Posted February 3, 2013 Posted February 3, 2013 You did it other way then, your code is wrong.
Fury Posted February 3, 2013 Posted February 3, 2013 setTimer( function () if ( getElementHealth ( getPedOccupiedVehicle ( source ) ) == 800 ) then -- your code goes here end end, 1000, 0 )
gerlachmax123 Posted February 4, 2013 Author Posted February 4, 2013 pruefungsrepVehicle local pruefungsrepVehicle = createVehicle ( 507, 1174.229, 1339.781, 10.637, 359.764, 0, 180.851 ) --Elegant
TAPL Posted February 4, 2013 Posted February 4, 2013 tt = setTimer(function() if isElement(pruefungsrepVehicle) and getElementHealth(pruefungsrepVehicle) <= 800 then local player = getVehicleController(pruefungsrepVehicle) if player then if isTimer(tt) then killTimer(tt) end destroyElement(pruefungsrepVehicle) outputChatBox("Nice Job!", player, 125, 0, 0) setElementPosition(player, 1172.158, 1350.906, 10.922) setElementDimension(player, 0) end end end, 3000, 0)
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