~Air Posted December 31, 2014 Posted December 31, 2014 Hey guys, I got a problem, when somebody wins the text doesn't get removed.. (it's only at last survivor, the wintext works perfectly) Here's the code: addEvent("onWins", true) function drawNexMapString(player,wintext) local x, y = guiGetScreenSize() if wintext == "none" then else winnertext = dxText:create(wintext, x/2, y/2 -180 + 1, false, "default-bold", 1.65, "center") winnertext:type('shadow', 1.3,1) winnertext:font("default-bold") setTimer( function() winnertext:visible(false) end, 5000, 1) end winner = dxText:create("" ..getPlayerNametagText(player).." #FFFFFFis the final survivor!", x/2, y/2 -150 + 1, false, "default-bold", 1.65, "center") winner:type('shadow', 1.3,1) winner:font("default-bold") end setTimer( function() winner:visible(false) end, 5000, 1) addEventHandler("onWins", getRootElement(), drawNexMapString)
~Air Posted December 31, 2014 Author Posted December 31, 2014 Not really. But I found this one: Attempt to index global 'winner' (a nil value)
Castillo Posted December 31, 2014 Posted December 31, 2014 I guess "winner" text is not being created?
~Air Posted December 31, 2014 Author Posted December 31, 2014 winner = dxText:create("" ..getPlayerNametagText(player).." #FFFFFFis the final survivor!", x/2, y/2 -150 + 1, false, "default-bold", 1.65, "center") Hmm, don't know It worked some weeks ago, I didn't change anything.
Tree Academy Posted January 1, 2015 Posted January 1, 2015 are you have any SQL or Data in your script?
~Air Posted January 1, 2015 Author Posted January 1, 2015 No, but I think that doesn't matter because it's just a text. e: FIXXED IT, close it.
Castillo Posted January 1, 2015 Posted January 1, 2015 are you have any SQL or Data in your script? Please don't reply if you have absolutely no idea what is this about. @Air: One of the problems I just noticed, is that you have a timer outside of your "drawNexMapString" function, which causes it to execute when the resource starts, so 'winner' is nil then. Try this: function drawNexMapString ( player, wintext ) local x, y = guiGetScreenSize ( ) if ( wintext == "none" ) then else winnertext = dxText:create ( wintext, x/2, y/2 -180 + 1, false, "default-bold", 1.65, "center" ) winnertext:type ( 'shadow', 1.3, 1 ) winnertext:font ( "default-bold" ) setTimer ( function ( ) winnertext:visible ( false ) end ,5000, 1 ) end winner = dxText:create ( tostring ( getPlayerNametagText ( player ) ) .." #FFFFFFis the final survivor!", x/2, y/2 -150 + 1, false, "default-bold", 1.65, "center" ) winner:type ( 'shadow', 1.3, 1 ) winner:font ( "default-bold" ) setTimer ( function ( ) winner:visible ( false ) end ,5000, 1 ) end addEvent ( "onWins", true ) addEventHandler ( "onWins", getRootElement(), drawNexMapString )
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