JoZeFSvK Posted June 24, 2013 Posted June 24, 2013 I want when start map that show table but after 5 sec. to hide. like normal race_toptimes. function bindAll(res) if (getResourceName(res) == "Mafin13") then local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do bindKey ( thePlayer, "F2", "down", showTable ) bindKey ( thePlayer, "F3", "down", showCustomSrv, thePlayer ) end end end function bindPL() bindKey ( source, "F2", "down", showTable ) bindKey ( source, "F3", "down", showCustomSrv, source ) end addEventHandler ( "onResourceStart", getRootElement(), bindAll ) addEventHandler ( "onPlayerJoin", getRootElement(), bindPL) gui -- GUI: Top table local accounts = {} local showTop = 0 local alpha = 0 local alpha2 = 0 function createTopList (acc) accounts = acc if (showTop == 0) then showTop = 1 else showTop = 0 alpha = 0 end end addEvent( "showTopTable", true ) addEventHandler( "showTopTable", getLocalPlayer(), createTopList ) addEventHandler("onMapStart", getRootElement(), showTopTable) addEventHandler("onClientPreRender", getRootElement(), function() if (showTop == 1) then if (alpha < 255) then alpha = alpha + 15 end local x,y = guiGetScreenSize() x = x/2-100 y = y/2-200 dxDrawRectangle ( x-10, y-10, 220, 40, tocolor ( 0, 0, 0,200, alpha ) ) -- dxDrawText("Best Players", x, y-5, x+200, y+20, tocolor(255, 255, 255, alpha), "2", "sa-header", "center", "top") dxDrawRectangle ( x-10, y+25, 220, 1, tocolor ( 68, 153, 255,200, alpha,true ) ) --TOTO KURVA dxDrawRectangle ( x-10, y+30, 220, 310, tocolor ( 0, 0, 0,200, alpha ) ) y = y + 35 local pozicia,body = 0 for index, data in ipairs(accounts) do if (index < 21) then if (data.nick == getPlayerName(getLocalPlayer()) ) then dxDrawRectangle ( x-10, y+1, 220, 13, tocolor ( 0, 17, 66, alpha ) ) end dxDrawText(index..".)", x, y, x+25, y+15, tocolor(255, 255, 255, alpha), "1", "default-bold", "left", "center") dxDrawColorText(data.nick, x+25, y, x+150, y+15, tocolor(255, 255, 255, alpha), "1", "default-bold", "left", "center", alpha) dxDrawText(data.points, x+150, y, x+200, y+15, tocolor(255, 255, 255, alpha), "1", "default-bold", "right", "center") y = y + 15 end if (data.nick == getPlayerName(getLocalPlayer()) ) then pozicia = index body = data.points end end y = y + 5 dxDrawRectangle ( x-10, y, 220, 15, tocolor ( 0, 17, 66,200, alpha ) ) dxDrawText(pozicia..".)", x, y, x+25, y+15, tocolor(255, 255, 255, alpha), "1", "default-bold", "left", "center") dxDrawColorText(getPlayerName(getLocalPlayer()), x+25, y, x+150, y+15, tocolor(255, 255, 255, alpha), "1", "default-bold", "left", "center", alpha) dxDrawText(body, x+150, y, x+200, y+15, tocolor(255, 255, 255, alpha), "1", "default-bold", "right", "center") end end ) fileDelete("top.lua")
JoZeFSvK Posted June 25, 2013 Author Posted June 25, 2013 I try but dont work code function ukazcecky () onGamemodeMapStart (showTopTable, ..setTimer (5000) ) end
JoZeFSvK Posted June 26, 2013 Author Posted June 26, 2013 function ukaz ( ) -- i dont know what put here setTimer ( ukaz, 5000 ) addEventHandler ( "onMapStart", getRootElement(), ukaz )
~DarkRacer~ Posted June 27, 2013 Posted June 27, 2013 Then i dont know how to hide a gui element use guiSetVisible this is an example hiding an element in 5 seconds using a timer: setTimer(guiSetVisible,5000,1,GUI_ELEMENT,false) -- Replace GUI_ELEMENT with your window..
Castillo Posted June 27, 2013 Posted June 27, 2013 He's not using GUI, which you can notice if you read the entire topic ( well, just the first post actually ).
~DarkRacer~ Posted June 27, 2013 Posted June 27, 2013 He's not using GUI, which you can notice if you read the entire topic ( well, just the first post actually ). Oh sorry, i didn't notice that besides he said "GUI:" then he put his code. if that's so he can use removeEventHandler here's an example with setTimer : setTimer(removeEventHandler,5000,1,"onClientPreRender", getRootElement(), FUNCTION_NAME)
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