Jump to content

Mechanic


Sasu

Recommended Posts

Posted

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.

Posted
    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?

Posted

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 .

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...