Jump to content

OnMapStart Show Table


JoZeFSvK

Recommended Posts

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") 
  

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