Jump to content

about GUİ


myyusuf

Recommended Posts

hello scripters, im trying to make a gui panel for my stats script. i have a problem now.

    local playerSerial = getPlayerSerial( thePlayer ) 
    local playerPoint = getElementData(getLocalPlayer(), "points") 
    local playerWins = getElementData(getLocalPlayer(), "wins")    
    local playerSecond = getElementData(getLocalPlayer(), "second") 
    local playerThird = getElementData(getLocalPlayer(), "third") 
    local playerRank = getElementData(getLocalPlayer(), "rank") 
     
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
  
GUIEditor_Window[1] = guiCreateWindow(355,249,503,303,"FuckN| Destruction Derby Userpanel v1.01",false) 
GUIEditor_Label[1] = guiCreateLabel(20,31,196,26,"Your Stats:",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(20,68,34,16,"Serial:",false,GUIEditor_Window[1]) 
GUIEditor_Label[3] = guiCreateLabel(19,99,32,17,"Wins:",false,GUIEditor_Window[1]) 
GUIEditor_Label[4] = guiCreateLabel(18,129,38,16,"Points:",false,GUIEditor_Window[1]) 
GUIEditor_Label[5] = guiCreateLabel(17,159,83,16,"Second places:",false,GUIEditor_Window[1]) 
GUIEditor_Label[6] = guiCreateLabel(16,184,73,15,"Third places:",false,GUIEditor_Window[1]) 
GUIEditor_Label[7] = guiCreateLabel(17,213,33,17,"Rank:",false,GUIEditor_Window[1]) 
GUIEditor_Button[1] = guiCreateButton(369,259,113,30,"Close (F3)",false,GUIEditor_Window[1]) 
GUIEditor_Label[8] = guiCreateLabel(384,27,114,18,"Created by FuckN|V",false,GUIEditor_Window[1]) 
GUIEditor_Image[1] = guiCreateStaticImage(14,249,183,37,"images/shruk.png",false,GUIEditor_Window[1]) 
GUIEditor_Label[9] = guiCreateLabel(58,68,287,17,"" ..playerSerial.. "",false,GUIEditor_Window[1]) 
GUIEditor_Label[10] = guiCreateLabel(55,100,287,17,"" ..playerWins.. "",false,GUIEditor_Window[1]) 
GUIEditor_Label[11] = guiCreateLabel(60,129,287,17,"" ..playerPoints.. "",false,GUIEditor_Window[1]) 
GUIEditor_Label[12] = guiCreateLabel(102,159,287,17,"" ..playerSecond.. "",false,GUIEditor_Window[1]) 
GUIEditor_Label[13] = guiCreateLabel(90,184,287,17,"" ..playerThird.. "",false,GUIEditor_Window[1]) 
GUIEditor_Label[14] = guiCreateLabel(51,213,287,17,"" ..playerRank.. "",false,GUIEditor_Window[1]) 

how can i take datas from server-side? also how can i add bind for gui and set mouse visible? thanks for now.

Link to comment

check wiki:

these are just examples from wiki, should help.

  
showCursor ( true ) -- Shows cursor 
showCursor ( false ) -- Doesnt Show Cursor 
  

function funcInput ( key, keyState ) 
  local state = "let go of" 
  if ( keyState == "down" ) then 
    state = "pressed" 
  end 
  outputChatBox ( "You " .. state .. " the " .. key .. " key!" ) 
end 
  
function bindTheKeys () 
  bindKey ( "F1", "down", funcInput )   -- bind the player's F1 down key (when they press it) 
end 
addCommandHandler ( "bindme", bindTheKeys ) 

function greetingCommand ( commandName ) 
    triggerServerEvent ( "onGreeting", getLocalPlayer(), "Hello World!" )  
    -- getLocalPlayer instead of getRootElement makes the client player the 'source' on the server function, eliminating the need for an additional player argument to be transferred. 
end 
addCommandHandler ( "greet", greetingCommand ) 

Link to comment

you can take datas from server to client using [ triggerServerEvent ] and from client to server using [ triggerClientEvent ]

example :

-- Client Side

  
GUIEditor_Label[1] = guiCreateLabel(20,31,196,26,"Your Stats:",false,GUIEditor_Window[1]) -- example label 
if GUIEditor_Label[1] then 
     triggerServerEvent("getStatsToGUI",getLocalPlayer()) -- trigger server event to ask for data  
end 
  
addEvent("sendStatsToGUI",true)  --- added event to retrive data from server 
addEventHandler("sendStatsToGUI",root,function(stats) 
if stats then 
     guiSetText(GUIEditor_Label[1] ,"Your Stats"..stats)-- set label text to the stats  
end 
end ) 
  

-- Server Side

  
addEvent("getStatsToGUI",true) 
addEventHandler("getStatsToGUI",root,function() 
       stats = getElementData(source,"Stats") -- source here is local player @ client side, and "Stats" is just for example 
       if stats then 
           triggerClientEvent(source,"sendStatsToGUI",source,stats) --- send the stats back to client side 
        end 
end ) 
  

Link to comment

thank you for helping to me. im trying to make it someting, but it doesnt take "stats" from serverside. where am i wrong?

client.lua

    local playerSerial = getPlayerSerial( thePlayer ) 
  
    GUIEditor_Window = {} 
    GUIEditor_Button = {} 
    GUIEditor_Label = {} 
    GUIEditor_Image = {} 
    showCursor ( true ) 
    GUIEditor_Window[1] = guiCreateWindow(355,249,503,303,":O| Destruction Derby Userpanel v1.01",false) 
  
    GUIEditor_Label[1] = guiCreateLabel(20,31,196,26,"Your Stats:",false,GUIEditor_Window[1]) 
  
    GUIEditor_Label[2] = guiCreateLabel(20,68,34,16,"Serial:",false,GUIEditor_Window[1]) 
    GUIEditor_Label[9] = guiCreateLabel(58,68,287,17,"" ..playerSerial.. "",false,GUIEditor_Window[1]) 
  
    GUIEditor_Label[3] = guiCreateLabel(19,99,32,17,"Wins:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[3] then 
    triggerServerEvent("GUIwins",getLocalPlayer()) 
    end 
  
    addEvent("GUIwins",true) 
    addEventHandler("GUIwins",root,function(wins) 
    if stats then 
    GUIEditor_Label[10] = guiCreateLabel(55,100,287,17,"" ..wins.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[4] = guiCreateLabel(18,129,38,16,"Points:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[4] then 
    triggerServerEvent("GUIpoints",getLocalPlayer()) 
    end 
  
    addEvent("GUIpoints",true) 
    addEventHandler("GUIpoints",root,function(points) 
    if stats then 
    GUIEditor_Label[11] = guiCreateLabel(60,129,287,17,"" ..points.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[5] = guiCreateLabel(17,159,83,16,"Second places:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[5] then 
    triggerServerEvent("GUIsecond",getLocalPlayer()) 
    end 
  
    addEvent("GUIsecond",true) 
    addEventHandler("GUIsecond",root,function(second) 
    if stats then 
    GUIEditor_Label[12] = guiCreateLabel(102,159,287,17,"" ..second.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[6] = guiCreateLabel(16,184,73,15,"Third places:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[6] then 
    triggerServerEvent("GUIthird",getLocalPlayer()) 
    end 
  
    addEvent("GUIthird",true) 
    addEventHandler("GUIthird",root,function(third) 
    if stats then 
    GUIEditor_Label[13] = guiCreateLabel(90,184,287,17,"" ..third.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[7] = guiCreateLabel(17,213,33,17,"Rank:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[7] then 
    triggerServerEvent("GUIrank",getLocalPlayer()) 
    end 
  
    addEvent("GUIrank",true) 
    addEventHandler("GUIrank",root,function(rank) 
    if stats then 
    GUIEditor_Label[14] = guiCreateLabel(51,213,287,17,"" ..rank.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Button[1] = guiCreateButton(369,259,113,30,"Close (F3)",false,GUIEditor_Window[1]) 
    GUIEditor_Label[8] = guiCreateLabel(384,27,114,18,"Created by |V",false,GUIEditor_Window[1]) 
    GUIEditor_Image[1] = guiCreateStaticImage(14,249,183,37,"images/shruk.png",false,GUIEditor_Window[1]) 
  
  

server.lua

  
    addEvent("GUIwins",true) 
    addEventHandler("GUIwins",root,function() 
           wins = getElementData(source,"wins") 
               triggerClientEvent(source,"GUIwins",source,wins) 
            end 
    end) 
      
    addEvent("GUIpoints,true) 
    addEventHandler("GUIpoints",root,function() 
           points = getElementData(source,"points") 
               triggerClientEvent(source,"GUIpoints",source,points) 
            end 
    end) 
      
    addEvent("GUIsecond",true) 
    addEventHandler("GUIsecond",root,function() 
           second = getElementData(source,"second") 
               triggerClientEvent(source,"GUIsecond",source,second) 
            end 
    end) 
     
    addEvent("GUIthird",true) 
    addEventHandler("GUIthird",root,function() 
           third = getElementData(source,"third") 
               triggerClientEvent(source,"GUIthird",source,third) 
            end 
    end) 
      
    addEvent("GUIrank",true) 
    addEventHandler("GUIrank",root,function() 
           rank = getElementData(source,"rank") 
               triggerClientEvent(source,"GUIrank",source,rank) 
            end 
    end) 
      
function addbind(player) 
    unbindKey(player, "F1", "down", toggleManager) 
    bindKey(player, "F1", "down", toggleManager) 
end 
  
  
  
 

i have this warning: sts/server.lua:7: ')' expected (to close '(' at line 3) near 'end'. what can i do for that?

Link to comment
    addEvent("GUIwins",true) 
    addEventHandler("GUIwins",root,function() 
           wins = getElementData(source,"wins") 
               triggerClientEvent(source,"GUIwins",source,wins) 
            end 
    ) 
      
    addEvent("GUIpoints",true) 
    addEventHandler("GUIpoints",root,function() 
           points = getElementData(source,"points") 
               triggerClientEvent(source,"GUIpoints",source,points) 
            end 
 ) 
      
    addEvent("GUIsecond",true) 
    addEventHandler("GUIsecond",root,function() 
           second = getElementData(source,"second") 
               triggerClientEvent(source,"GUIsecond",source,second) 
            end 
) 
     
    addEvent("GUIthird",true) 
    addEventHandler("GUIthird",root,function() 
           third = getElementData(source,"third") 
               triggerClientEvent(source,"GUIthird",source,third) 
            end 
 ) 
      
    addEvent("GUIrank",true) 
    addEventHandler("GUIrank",root,function() 
           rank = getElementData(source,"rank") 
               triggerClientEvent(source,"GUIrank",source,rank) 
            end 
  ) 
      
function addbind(player) 
    unbindKey(player, "F1", "down", toggleManager) 
  
end 
  
  
function unbind(player) 
    bindKey(player, "F1", "down", toggleManager) 
  
end 
  

Link to comment
    addEvent("GUIwins",true) 
    addEventHandler("GUIwins",root,function() 
           wins = getElementData(source,"wins") 
               triggerClientEvent(source,"GUIwins",source,wins) 
            end 
    ) 
      
    addEvent("GUIpoints",true) 
    addEventHandler("GUIpoints",root,function() 
           points = getElementData(source,"points") 
               triggerClientEvent(source,"GUIpoints",source,points) 
            end 
 ) 
      
    addEvent("GUIsecond",true) 
    addEventHandler("GUIsecond",root,function() 
           second = getElementData(source,"second") 
               triggerClientEvent(source,"GUIsecond",source,second) 
            end 
) 
     
    addEvent("GUIthird",true) 
    addEventHandler("GUIthird",root,function() 
           third = getElementData(source,"third") 
               triggerClientEvent(source,"GUIthird",source,third) 
            end 
 ) 
      
    addEvent("GUIrank",true) 
    addEventHandler("GUIrank",root,function() 
           rank = getElementData(source,"rank") 
               triggerClientEvent(source,"GUIrank",source,rank) 
            end 
  ) 
      
function addbind(player) 
    unbindKey(player, "F1", "down", toggleManager) 
  
end 
  
  
function unbind(player) 
    bindKey(player, "F1", "down", toggleManager) 
  
end 
  

thanks. no warning but it dont show stats now. and bindkey isnt working. :(

Link to comment

Use bindKey clientside with GuiSetVisible

https://wiki.multitheftauto.com/wiki/GuiSetVisible

function changeVisibility ( ) 
        -- we check if the gui element is visible 
        if guiGetVisible ( myWindow ) then 
                -- if it is, we hide it 
                guiSetVisible ( myWindow, false ) 
        else 
                -- if not, we make it visible 
                guiSetVisible ( myWindow, true ) 
        end 
end 
  
--Create a gui window called 'myWindow' 
myWindow = guiCreateWindow ( 0.3, 0.3, 0.5, 0.60, "GUI window title", true ) 
--Set a timer to change the window's visibility every 2 seconds, infinite times 
setTimer ( changeVisibility, 2000, 0 ) 

https://wiki.multitheftauto.com/wiki/GuiGetVisible

function guiToggleVisible ( )         
        if ( guiGetVisible ( myWindow ) == true ) then -- check if the gui element is visible                
                guiSetVisible ( myWindow, false ) -- if it is, we hide it 
        else               
                guiSetVisible ( myWindow, true ) -- if not, we make it visible 
        end 
end 
  
myWindow = guiCreateWindow ( 0, 0, .5, .5, "my window", true ) -- Create the gui window 
bindKey ( "space", "down", guiToggleVisible ) --bind the player's spacebar to the function guiToggleVisible 

Link to comment
Use bindKey clientside with GuiSetVisible

https://wiki.multitheftauto.com/wiki/GuiSetVisible

function changeVisibility ( ) 
        -- we check if the gui element is visible 
        if guiGetVisible ( myWindow ) then 
                -- if it is, we hide it 
                guiSetVisible ( myWindow, false ) 
        else 
                -- if not, we make it visible 
                guiSetVisible ( myWindow, true ) 
        end 
end 
  
--Create a gui window called 'myWindow' 
myWindow = guiCreateWindow ( 0.3, 0.3, 0.5, 0.60, "GUI window title", true ) 
--Set a timer to change the window's visibility every 2 seconds, infinite times 
setTimer ( changeVisibility, 2000, 0 ) 

https://wiki.multitheftauto.com/wiki/GuiGetVisible

function guiToggleVisible ( )         
        if ( guiGetVisible ( myWindow ) == true ) then -- check if the gui element is visible                
                guiSetVisible ( myWindow, false ) -- if it is, we hide it 
        else               
                guiSetVisible ( myWindow, true ) -- if not, we make it visible 
        end 
end 
  
myWindow = guiCreateWindow ( 0, 0, .5, .5, "my window", true ) -- Create the gui window 
bindKey ( "space", "down", guiToggleVisible ) --bind the player's spacebar to the function guiToggleVisible 

thank you. but i have a problem now. when i press f1 it shows only mouse. i cant see the gui window.

    GUIEditor_Window = {} 
    GUIEditor_Button = {} 
    GUIEditor_Label = {} 
    GUIEditor_Image = {} 
    showCursor ( true ) 
  
function changeVisibility ( ) 
        if guiGetVisible ( GUIEditor_Window[1] ) then 
                guiSetVisible ( GUIEditor_Window[1], false ) 
        else 
                guiSetVisible ( GUIEditor_Window[1], true ) 
        end 
end 
  
GUIEditor_Window[1] = guiCreateWindow(355,249,503,303,":O| Destruction Derby Userpanel v1.01", true)  
setTimer ( changeVisibility, 10, 0 ) 
  
function guiToggleVisible ( )         
        if ( guiGetVisible ( GUIEditor_Window[1] ) == true ) then 
                guiSetVisible ( GUIEditor_Window[1], false )  
        else               
                guiSetVisible ( GUIEditor_Window[1], true )  
        end 
end 
  
GUIEditor_Window[1] = guiCreateWindow(355,249,503,303,":O| Destruction Derby Userpanel v1.01",true)  
bindKey ( "f1", "down", guiToggleVisible )  
  
  
  
  
    local playerSerial = getPlayerSerial( thePlayer ) 
  
  
  
    GUIEditor_Label[1] = guiCreateLabel(20,31,196,26,"Your Stats:",false,GUIEditor_Window[1]) 
  
    GUIEditor_Label[2] = guiCreateLabel(20,68,34,16,"Serial:",false,GUIEditor_Window[1]) 
    GUIEditor_Label[9] = guiCreateLabel(58,68,287,17,"" ..playerSerial.. "",false,GUIEditor_Window[1]) 
  
    GUIEditor_Label[3] = guiCreateLabel(19,99,32,17,"Wins:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[3] then 
    triggerServerEvent("GUIwins",getLocalPlayer()) 
    end 
  
    addEvent("GUIwins",true) 
    addEventHandler("GUIwins",root,function(wins) 
    if stats then 
    GUIEditor_Label[10] = guiCreateLabel(55,100,287,17,"" ..wins.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[4] = guiCreateLabel(18,129,38,16,"Points:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[4] then 
    triggerServerEvent("GUIpoints",getLocalPlayer()) 
    end 
  
    addEvent("GUIpoints",true) 
    addEventHandler("GUIpoints",root,function(points) 
    if stats then 
    GUIEditor_Label[11] = guiCreateLabel(60,129,287,17,"" ..points.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[5] = guiCreateLabel(17,159,83,16,"Second places:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[5] then 
    triggerServerEvent("GUIsecond",getLocalPlayer()) 
    end 
  
    addEvent("GUIsecond",true) 
    addEventHandler("GUIsecond",root,function(second) 
    if stats then 
    GUIEditor_Label[12] = guiCreateLabel(102,159,287,17,"" ..second.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[6] = guiCreateLabel(16,184,73,15,"Third places:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[6] then 
    triggerServerEvent("GUIthird",getLocalPlayer()) 
    end 
  
    addEvent("GUIthird",true) 
    addEventHandler("GUIthird",root,function(third) 
    if stats then 
    GUIEditor_Label[13] = guiCreateLabel(90,184,287,17,"" ..third.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Label[7] = guiCreateLabel(17,213,33,17,"Rank:",false,GUIEditor_Window[1]) 
    if GUIEditor_Label[7] then 
    triggerServerEvent("GUIrank",getLocalPlayer()) 
    end 
  
    addEvent("GUIrank",true) 
    addEventHandler("GUIrank",root,function(rank) 
    if stats then 
    GUIEditor_Label[14] = guiCreateLabel(51,213,287,17,"" ..rank.. "",false,GUIEditor_Window[1]) 
    end 
    end ) 
  
    GUIEditor_Button[1] = guiCreateButton(369,259,113,30,"Close (F3)",false,GUIEditor_Window[1]) 
    GUIEditor_Label[8] = guiCreateLabel(384,27,114,18,"Created by |V",false,GUIEditor_Window[1]) 
    GUIEditor_Image[1] = guiCreateStaticImage(14,249,183,37,"images/shruk.png",false,GUIEditor_Window[1]) 
  
  

Link to comment
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
   
GUIEditor_Window[1] = guiCreateWindow(355,249,503,303,":O| Destruction Derby Userpanel v1.01", true) 
guiSetVisible ( GUIEditor_Window[1], false ) 
GUIEditor_Button[1] = guiCreateButton(369,259,113,30,"Close (F3)",false,GUIEditor_Window[1]) 
GUIEditor_Label[8] = guiCreateLabel(384,27,114,18,"Created by |V",false,GUIEditor_Window[1]) 
GUIEditor_Image[1] = guiCreateStaticImage(14,249,183,37,"images/shruk.png",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(355,249,503,303,":O| Destruction Derby Userpanel v1.01",true) 
GUIEditor_Label[1] = guiCreateLabel(20,31,196,26,"Your Stats:",false,GUIEditor_Window[2]) 
GUIEditor_Label[2] = guiCreateLabel(20,68,34,16,"Serial:",false,GUIEditor_Window[2]) 
GUIEditor_Label[9] = guiCreateLabel(58,68,287,17,"".. getPlayerSerial ( ) .."",false,GUIEditor_Window[2]) 
GUIEditor_Label[3] = guiCreateLabel(19,99,32,17,"Wins:",false,GUIEditor_Window[2]) 
GUIEditor_Label[4] = guiCreateLabel(18,129,38,16,"Points:",false,GUIEditor_Window[2]) 
GUIEditor_Label[5] = guiCreateLabel(17,159,83,16,"Second places:",false,GUIEditor_Window[2]) 
GUIEditor_Label[6] = guiCreateLabel(16,184,73,15,"Third places:",false,GUIEditor_Window[2]) 
GUIEditor_Label[7] = guiCreateLabel(17,213,33,17,"Rank:",false,GUIEditor_Window[2]) 
triggerServerEvent("GUIwins",getLocalPlayer()) 
triggerServerEvent("GUIpoints",getLocalPlayer()) 
triggerServerEvent("GUIsecond",getLocalPlayer()) 
triggerServerEvent("GUIthird",getLocalPlayer()) 
triggerServerEvent("GUIrank",getLocalPlayer()) 
  
function guiToggleVisible ( ) 
    guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
    showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
end 
bindKey ( "f1", "down", guiToggleVisible ) 
  
addEvent ( "GUIwins", true ) 
addEventHandler ( "GUIwins", root, 
    function ( wins ) 
        if ( wins ) then 
            GUIEditor_Label[10] = guiCreateLabel ( 55, 100, 287, 17, "".. wins .. "", false, GUIEditor_Window[2] ) 
        end 
    end 
) 
  
addEvent ( "GUIpoints", true ) 
addEventHandler ( "GUIpoints" ,root, 
    function ( points ) 
        if ( points ) then 
            GUIEditor_Label[11] = guiCreateLabel ( 60, 129, 287, 17, "".. points .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 
  
addEvent ( "GUIsecond", true ) 
addEventHandler ( "GUIsecond",root, 
    function ( second ) 
        if ( second ) then 
            GUIEditor_Label[12] = guiCreateLabel ( 102, 159, 287, 17, "".. second .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 
  
addEvent ( "GUIthird", true ) 
addEventHandler ( "GUIthird", root, 
    function ( third ) 
        if ( third ) then 
            GUIEditor_Label[13] = guiCreateLabel ( 90, 184, 287, 17, "".. third .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 
  
addEvent ( "GUIrank", true ) 
addEventHandler ( "GUIrank", root, 
    function ( rank ) 
        if ( rank ) then 
            GUIEditor_Label[14] = guiCreateLabel ( 51, 213, 287, 17, "".. rank .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 

Link to comment
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Label = {} 
GUIEditor_Image = {} 
   
GUIEditor_Window[1] = guiCreateWindow(355,249,503,303,":O| Destruction Derby Userpanel v1.01", true) 
guiSetVisible ( GUIEditor_Window[1], false ) 
GUIEditor_Button[1] = guiCreateButton(369,259,113,30,"Close (F3)",false,GUIEditor_Window[1]) 
GUIEditor_Label[8] = guiCreateLabel(384,27,114,18,"Created by |V",false,GUIEditor_Window[1]) 
GUIEditor_Image[1] = guiCreateStaticImage(14,249,183,37,"images/shruk.png",false,GUIEditor_Window[1]) 
  
GUIEditor_Window[2] = guiCreateWindow(355,249,503,303,":O| Destruction Derby Userpanel v1.01",true) 
GUIEditor_Label[1] = guiCreateLabel(20,31,196,26,"Your Stats:",false,GUIEditor_Window[2]) 
GUIEditor_Label[2] = guiCreateLabel(20,68,34,16,"Serial:",false,GUIEditor_Window[2]) 
GUIEditor_Label[9] = guiCreateLabel(58,68,287,17,"".. getPlayerSerial ( ) .."",false,GUIEditor_Window[2]) 
GUIEditor_Label[3] = guiCreateLabel(19,99,32,17,"Wins:",false,GUIEditor_Window[2]) 
GUIEditor_Label[4] = guiCreateLabel(18,129,38,16,"Points:",false,GUIEditor_Window[2]) 
GUIEditor_Label[5] = guiCreateLabel(17,159,83,16,"Second places:",false,GUIEditor_Window[2]) 
GUIEditor_Label[6] = guiCreateLabel(16,184,73,15,"Third places:",false,GUIEditor_Window[2]) 
GUIEditor_Label[7] = guiCreateLabel(17,213,33,17,"Rank:",false,GUIEditor_Window[2]) 
triggerServerEvent("GUIwins",getLocalPlayer()) 
triggerServerEvent("GUIpoints",getLocalPlayer()) 
triggerServerEvent("GUIsecond",getLocalPlayer()) 
triggerServerEvent("GUIthird",getLocalPlayer()) 
triggerServerEvent("GUIrank",getLocalPlayer()) 
  
function guiToggleVisible ( ) 
    guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
    showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
end 
bindKey ( "f1", "down", guiToggleVisible ) 
  
addEvent ( "GUIwins", true ) 
addEventHandler ( "GUIwins", root, 
    function ( wins ) 
        if ( wins ) then 
            GUIEditor_Label[10] = guiCreateLabel ( 55, 100, 287, 17, "".. wins .. "", false, GUIEditor_Window[2] ) 
        end 
    end 
) 
  
addEvent ( "GUIpoints", true ) 
addEventHandler ( "GUIpoints" ,root, 
    function ( points ) 
        if ( points ) then 
            GUIEditor_Label[11] = guiCreateLabel ( 60, 129, 287, 17, "".. points .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 
  
addEvent ( "GUIsecond", true ) 
addEventHandler ( "GUIsecond",root, 
    function ( second ) 
        if ( second ) then 
            GUIEditor_Label[12] = guiCreateLabel ( 102, 159, 287, 17, "".. second .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 
  
addEvent ( "GUIthird", true ) 
addEventHandler ( "GUIthird", root, 
    function ( third ) 
        if ( third ) then 
            GUIEditor_Label[13] = guiCreateLabel ( 90, 184, 287, 17, "".. third .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 
  
addEvent ( "GUIrank", true ) 
addEventHandler ( "GUIrank", root, 
    function ( rank ) 
        if ( rank ) then 
            GUIEditor_Label[14] = guiCreateLabel ( 51, 213, 287, 17, "".. rank .."", false, GUIEditor_Window[2] ) 
        end 
    end  
) 

thank you man :D

Link to comment

last question. where am i wrong on this code?

setTimer ( triggerServerEvent, 100, 1, "GUIwins",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIpoints",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIsecond",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIthird",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIrank",getLocalPlayer()) 

it doesnt trigger in every 100 ms. :/

Link to comment
last question. where am i wrong on this code?
setTimer ( triggerServerEvent, 100, 1, "GUIwins",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIpoints",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIsecond",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIthird",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIrank",getLocalPlayer()) 

it doesnt trigger in every 100 ms. :/

I not understand what you mean.

You need trigger this event each 100 mms?

Link to comment
last question. where am i wrong on this code?
setTimer ( triggerServerEvent, 100, 1, "GUIwins",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIpoints",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIsecond",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIthird",getLocalPlayer()) 
setTimer ( triggerServerEvent, 100, 1, "GUIrank",getLocalPlayer()) 

it doesnt trigger in every 100 ms. :/

I not understand what you mean.

You need trigger this event each 100 mms?

yes that what im trying.

Link to comment
  
setTimer (  
    function( ) 
        triggerServerEvent( "GUIwins", localPlayer ) 
        triggerServerEvent( "GUIpoints", localPlayer ) 
        triggerServerEvent( "GUIsecond" localPlayer ) 
        triggerServerEvent( "GUIthird", localPlayer ) 
        triggerServerEvent( "GUIrank", localPlayer ) 
    end, 
100, 
0 ) 
  

?

I think it's bad idea.

Link to comment
  
setTimer (  
    function( ) 
        triggerServerEvent( "GUIwins", localPlayer ) 
        triggerServerEvent( "GUIpoints", localPlayer ) 
        triggerServerEvent( "GUIsecond" localPlayer ) 
        triggerServerEvent( "GUIthird", localPlayer ) 
        triggerServerEvent( "GUIrank", localPlayer ) 
    end, 
100, 
0 ) 
  

?

I think it's bad idea.

yeah really bad idea. i solved the problem. thanks for helping :)

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