Jump to content

Como hacer refresh a una function


iFoReX

Recommended Posts

Posted

Ok aca esta todo

GUIEditor_Window = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.2275,0.2367,0.5362,0.4900,"GUI Stats",true) 
GUIEditor_Grid[1] = guiCreateGridList(261,36,158,280,false,GUIEditor_Window[1]) 
column = guiGridListAddColumn(GUIEditor_Grid[1],"Jugadores",0.80) 
GUIEditor_Label[1] = guiCreateLabel(10,58,233,23,"Nickname : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"clear-normal") 
GUIEditor_Label[2] = guiCreateLabel(10,91,233,23,"Location : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[2],"clear-normal") 
GUIEditor_Label[4] = guiCreateLabel(10,157,233,23,"Skin : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[4],"clear-normal") 
GUIEditor_Label[5] = guiCreateLabel(10,190,233,23,"Ping : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[5],"clear-normal") 
GUIEditor_Label[6] = guiCreateLabel(10,223,233,23,"Dimension : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[6],"clear-normal") 
GUIEditor_Label[7] = guiCreateLabel(10,125,233,23,"Team : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[7],"clear-normal") 
credits = guiCreateLabel(10,290,233,23,"GUI Made by ElMota",false,GUIEditor_Window[1])      ---Aqui esta el LABEL 
  
guiSetVisible( GUIEditor_Window[1], false ) 
showCursor ( false ) 
  
function showGUI ( ) 
    guiSetVisible ( GUIEditor_Window[1], not guiGetVisible ( GUIEditor_Window[1] ) ) 
    showCursor ( guiGetVisible ( GUIEditor_Window[1] ) ) 
end 
bindKey ( "F2","down", showGUI ) 
  
function atualizarlista() 
    guiGridListClear(GUIEditor_Grid[1]) 
    if (guiGridListClear) then 
    for id, players in ipairs (getElementsByType("player")) do 
        local row = guiGridListAddRow(GUIEditor_Grid[1]) 
        guiGridListSetItemText(GUIEditor_Grid[1], row, 1, (getPlayerName(players)), false, false) 
        guiGridListSetItemColor ( GUIEditor_Grid[1], row, 1, 0, 250, 255, 255 ) 
    end 
end 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), atualizarlista) 
addEventHandler("onClientPlayerQuit", getRootElement(), atualizarlista) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), atualizarlista) 
addEventHandler("onClientResourceStart", getRootElement(), atualizarlista) 
  
function anunciarGUI() 
outputChatBox( "[server] #000FFFPara ver la GUI De Stats porfavor preciona #00FF00F2", 255, 0, 0, true ) 
end 
addEventHandler("onClientResourceStart", getRootElement(), anunciarGUI) 
addEventHandler("onClientPlayerJoin", getRootElement(), anunciarGUI) 
  
setTimer( 
function() 
outputChatBox( "[server] #000FFFPara ver la GUI De Stats porfavor preciona #00FF00F2", 255, 0, 0, true ) 
end 
, 300000, 1 ) 
  
function setStats ( ) 
    if ( source == GUIEditor_Grid[1] ) then 
        local row, col = guiGridListGetSelectedItem ( source ) 
        if ( row and col and row ~= -1 and col ~= -1 ) then 
            local playername = guiGridListGetItemText ( source, row, col ) 
            local thePlayer = getPlayerFromName ( playername ) 
            if ( thePlayer ) then 
                local x, y, z = getElementPosition ( thePlayer ) 
                local location = getZoneName ( x, y, z ) 
                local money = getPlayerMoney( thePlayer ) 
                local id = getElementModel( thePlayer ) 
                local ping = getPlayerPing( thePlayer ) 
                local dm = getElementDimension( thePlayer ) 
                local tm1 = getPlayerTeam( thePlayer ) 
                local tm2 = getTeamName( tm1 ) 
                guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
                guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
                guiSetText ( GUIEditor_Label[4], "Skin : ".. id ) 
                guiSetText ( GUIEditor_Label[6], "Dimension : ".. dm ) 
                guiSetText ( GUIEditor_Label[7], "Team : ".. tm2 ) 
                     if ( ping > 300 ) then 
                     guiSetText ( GUIEditor_Label[5], "Ping ( very Bad ) : ".. ping ) 
                     elseif ( ping < 300 ) and ( ping > 150 ) then 
                     guiSetText ( GUIEditor_Label[5], "Ping ( Good ) : ".. ping ) 
                     elseif ( ping < 150 ) and ( ping > 100 ) then 
                     guiSetText ( GUIEditor_Label[5], "Ping ( VeryGood ) : ".. ping ) 
                     elseif ( ping < 100 ) and ( ping > 150 ) then 
                     guiSetText ( GUIEditor_Label[5], "Ping ( Nice! ) : ".. ping ) 
                     elseif ( ping > 50 ) and ( ping < 100 ) then 
                     guiSetText ( GUIEditor_Label[5], "Ping ( ChileanPlayer! ) : ".. ping ) 
                     elseif ( ping > 0 ) and ( ping < 50 ) then 
                     guiSetText ( GUIEditor_Label[5], "Ping ( ElMota! ) : ".. ping ) 
                     end 
            end 
        end 
    end 
end 
addEventHandler ( "onClientGUIDoubleClick", root, setStats ) 

Posted

Debe estar mal las coordenadas "y" capaz, porque esta bien los argumentos, a menos que ya exista una variable global llamada credits...pero ese no creo que sea el problema.

La otra es que algo lo tape algo al label, no se como es la imagen y donde deberia ir.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...