Sasu Posted March 25, 2013 Share Posted March 25, 2013 Why this dont work? :C function cursorMecanico(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if (state == "down" and clickedElement and getElementType(clickedElement) == "vehicle") then if (getElementHealth(clickedElement) <= 99) then setElementHealth(clickedElement, 100) givePlayerMoney(1000) outputChatBox("Has reparado un auto por lo tanto has ganado $1000.", 255, 255, 0) end end end addEventHandler("onClientClick", root, cursorMecanico) And no error. Link to comment
Smart. Posted March 25, 2013 Share Posted March 25, 2013 a vehicle got 1000 health so if (getElementHealth(clickedElement) <= 999) then Link to comment
Sasu Posted March 25, 2013 Author Share Posted March 25, 2013 function cursorMecanico(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement) if (state == "down" and clickedElement and getElementType(clickedElement) == "vehicle") then if (getElementHealth(clickedElement) <= 999) then setElementHealth(clickedElement, 1000) setElementPosition(clickedElement, worldX, worldY, worldZ+2) givePlayerMoney(1000) outputChatBox("Has reparado un auto por lo tanto has ganado $1000.", 255, 255, 0) end end end addEventHandler("onClientClick", root, cursorMecanico) Oh yes thanks. But when I click on vehicle, its explode. Why? Link to comment
Smart. Posted March 25, 2013 Share Posted March 25, 2013 You sure that the setElementHealth is 1000 not 100 in the script? Link to comment
Sasu Posted March 25, 2013 Author Share Posted March 25, 2013 Yes. Edit: It solved alone. ._. Thank you very much. Link to comment
iPrestege Posted March 25, 2013 Share Posted March 25, 2013 Remember this when you give the player the money and put the health of the vehicle will not appear for all players.It is better to trigger event to set Health and the Money . Link to comment
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