Jump to content

HELP - Pickup Problem


stevensalvaro

Recommended Posts

Hello,

How to make my 'guiCreateStaticImage' disappear when i leave the pickup ?

Server

  
function carshop_pickupUse(thePlayer) 
    local parentCar = getElementData(source, "carshop:parentCar") 
    if parentCar and isElement(parentCar) then 
        local costCar = getElementData(parentCar, "carshop:cost") 
        local costTax = getElementData(parentCar, "carshop:taxcost") 
        if costCar and costTax then 
            triggerClientEvent(thePlayer, "carshop:showInfo", parentCar, costCar, costTax) 
        end 
        cancelEvent() 
    end 
end 
addEventHandler("onPickupHit", getResourceRootElement(), carshop_pickupUse) 
  

Client

  
function carshop_showInfo(carPrice, taxPrice) 
    box = guiCreateStaticImage(120, 350, 150, 50, "mulai.png" , false, nil) 
end 
addEvent("carshop:showInfo", true) 
addEventHandler("carshop:showInfo", getRootElement(), carshop_showInfo) 
  

Link to comment

There is no onPickupLeave.

trigger the pickup too and create an addEventHandler with onClientEvent.

There you can ask if the player is near the pickup (getElementDistanceBetweenPoints3D <= 3 should do it).

If not, remove the eventhandler and destroy gui.

Link to comment

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...