=FAS=Shigawire Posted September 30, 2008 Posted September 30, 2008 Hey guys, i have a problem the guiLabelSetColor doesn't work. Even the wiki example gves me an error: WARNING: XXX.lua: Bad 'gui-element' pointer@ guiLabelSetColor (1) http://development.mtasa.com/index.php?title=GuiLabelSetColor Is this function working on your server? IRC couldnt answer my question, too.
Ace_Gambit Posted September 30, 2008 Posted September 30, 2008 I have no problems using that function. Post the entire code snippet that throws the error.
=FAS=Shigawire Posted October 1, 2008 Author Posted October 1, 2008 Lol, i dont check that. on our server 66.117.58.164:22029 , all ppl say, the text is white. here is the code: http://mta.pastebin.com/d1a0bd6e1
Ace_Gambit Posted October 1, 2008 Posted October 1, 2008 I do recall an oddity when you create GUI elements before onClientResourceStart is triggered. Try to create the GUI labels inside onClientResourceStart and let me know if it makes any difference.
=FAS=Shigawire Posted October 1, 2008 Author Posted October 1, 2008 EEhhm, how do you mean that? I dont use Events in the Gui part bullets = 0 local health = guiCreateLabel ( 0.35, 0.025, 0.5, 0.5, "Bullets shot: " .. bullets .." ", true ) bulletshit = 0 local bhit = guiCreateLabel ( 0.45, 0.025, 0.5, 0.5, "Bullets hit: " .. bulletshit .." ", true ) local hitrtio = guiCreateLabel ( 0.55, 0.025, 0.5, 0.5, "Hit Ratio: " .. bulletshit / bullets .. " ", true ) guiLabelSetColor ( health , 0, 0, 255 ) guiLabelSetColor ( bhit , 0, 144, 255 ) guiLabelSetColor ( hitrtio , 0, 144, 255 ) function bulletscheck (weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) bullets = bullets + 1 guiSetText ( health, "Bullets shot: " .. bullets .. "" ) --outputChatBox ("" ..getElementType(hitElement)) if getElementType(hitElement) == "player" then bulletshit = bulletshit + 1 guiSetText ( bhit, "Bullets hit: " .. bulletshit .. "" ) end guiSetText ( hitrtio, "Hit Ratio: " .. math.floor(0.5 + (bulletshit / bullets)*100) / 100 .. " " ) end addEventHandler ("onClientPlayerWeaponFire", getLocalPlayer(), bulletscheck, guiLabelSetColor ( health , 0, 0, 255 )) function resetCounter () bullets = 0 bulletshit = 0 guiSetText ( health, "Bullets shot: " .. bullets .. "" ) guiSetText ( bhit, "Bullets hit: " .. bulletshit .. "" ) guiSetText ( hitrtio, "Hit Ratio: " .. math.floor(0.5 + (bulletshit / bullets)*100) / 100 .. " " ) end addEventHandler ("onClientPlayerSpawn", getLocalPlayer(), resetCounter)
Gamesnert Posted October 1, 2008 Posted October 1, 2008 EEhhm, how do you mean that?I dont use Events in the Gui part That's his point, you SHOULD!
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