Jump to content

Help gui labels


Alen141

Recommended Posts

Hey guys how are you today? Good, me too but I have a bit of a situation going on with my script here. So the problem is following:

[+] When I hit the marker first time it shows all correct : health, money, job, location!

----> PROBLEM ---->[-] When I hit the marker for second time it dosen't update it just creates another label, but I want to know if it's possible to update label or some way to delete it!

function openGUI( ) 
local playerX, playerY, playerZ = getElementPosition ( localPlayer )        
local playerZoneName = getZoneName ( playerX, playerY, playerZ ) 
local health = getElementHealth ( getLocalPlayer() ) 
local class = getElementData ( getLocalPlayer(), "Job" ) 
local cash = getPlayerMoney( getLocalPlayer() ) 
        guiSetVisible(reWnd, true) 
        showCursor(true) 
        money = guiCreateLabel(13, 93, 200, 19, "Money : "..cash.."$", false, reWnd) 
        job = guiCreateLabel(239, 93, 200, 19, "Job : "..class.."", false, reWnd) 
        hp = guiCreateLabel(239, 55, 200, 19, "Health : "..health.."%", false, reWnd) 
        loc = guiCreateLabel(13, 55, 200, 19, "Location : "..playerZoneName.."", false, reWnd) 
end 
addEventHandler("onClientPickupHit", disk, openGUI) 
addEventHandler("onClientPickupHit", disk1, openGUI) 
addEventHandler("onClientPickupHit", disk2, openGUI) 

Link to comment

check this

  
  
local function changeGUI ()  
       local playerX, playerY, playerZ = getElementPosition ( localPlayer )       
       local playerZoneName = getZoneName ( playerX, playerY, playerZ ) 
       local health = getElementHealth ( getLocalPlayer() ) 
       local class = getElementData ( getLocalPlayer(), "Job" ) 
        local cash = getPlayerMoney( getLocalPlayer() ) 
        guiSetVisible(reWnd, true) 
        showCursor(true) 
        guiSetText (money, "Money : "..cash.."$") 
        guiSetText(job,  "Job : "..class) 
        guiSetText(hp, "Health : "..health.."%") 
        guiSetText(loc, "Location : "..playerZoneName) 
  
end;  
  
local function openGUI( ) 
        local playerX, playerY, playerZ = getElementPosition ( localPlayer )       
        local playerZoneName = getZoneName ( playerX, playerY, playerZ ) 
        local health = getElementHealth ( getLocalPlayer() ) 
        local class = getElementData ( getLocalPlayer(), "Job" ) 
        local cash = getPlayerMoney( getLocalPlayer() ) 
        guiSetVisible(reWnd, true) 
        showCursor(true) 
        money = guiCreateLabel(13, 93, 200, 19, "Money : "..cash.."$", false, reWnd) 
        job = guiCreateLabel(239, 93, 200, 19, "Job : "..class, false, reWnd) 
        hp = guiCreateLabel(239, 55, 200, 19, "Health : "..health.."%", false, reWnd) 
        loc = guiCreateLabel(13, 55, 200, 19, "Location : "..playerZoneName, false, reWnd) 
  
        removeEventHandler ("onClientPickupHit", disk, openGUI); 
       removeEventHandler ("onClientPickupHit", disk1, openGUI); 
       removeEventHandler ("onClientPickupHit", disk2, openGUI); 
       addEventHandler ("onClientPickupHit", disk, changeGUI); 
       addEventHandler ("onClientPickupHit", disk1, changeGUI); 
       addEventHandler ("onClientPickupHit", disk2, changeGUI); 
end 
  
addEventHandler("onClientPickupHit", disk, openGUI) 
addEventHandler("onClientPickupHit", disk1, openGUI) 
addEventHandler("onClientPickupHit", disk2, openGUI)  
  

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