Jump to content

Como hacer refresh a una function


iFoReX

Recommended Posts

Posted

bueeno como dice el titulo quiero saber como darle refresh a una funcion para cuando un player se conecte y a causa de eso se actualize el gridlist

Aqui el script

GUIEditor_Window = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.2275,0.2367,0.5362,0.5533,"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[3] = guiCreateLabel(10,125,233,23,"Money : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[3],"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,255,233,23,"Serial : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[7],"clear-normal") 
  
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 losLabels ( ) 
    if ( column ) then 
        for id, playeritem in ipairs ( getElementsByType "player" ) do 
            local row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
            guiGridListSetItemText ( GUIEditor_Grid[1], row, column, getPlayerName ( playeritem ), false, false ) 
        end 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, losLabels ) 
addEventHandler ( "onClientPlayerJoin", resourceRoot, losLabels ) 
addEventHandler ( "onClientPlayerQuit", resourceRoot, losLabels ) 
addEventHandler ( "onClientPlayerChangeNick", resourceRoot, losLabels ) 
  
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 sr = getPlayerSerial() 
                guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
                guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
                guiSetText ( GUIEditor_Label[3], "Money : ".. money ) 
                guiSetText ( GUIEditor_Label[4], "Skin : ".. id ) 
                guiSetText ( GUIEditor_Label[6], "Dimension : ".. dm ) 
                guiSetText ( GUIEditor_Label[7], "Serial : "..tostring(sr) ) 
                     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 ) 

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted
GUIEditor_Window = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.2275,0.2367,0.5362,0.5533,"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[3] = guiCreateLabel(10,125,233,23,"Money : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[3],"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,255,233,23,"Serial : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[7],"clear-normal") 
  
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 losLabels ( ) 
    if ( column ) then 
        for id, playeritem in ipairs ( getElementsByType "player" ) do 
            local row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
            guiGridListSetItemText ( GUIEditor_Grid[1], row, column, getPlayerName ( playeritem ), false, false ) 
        end 
    end 
end 
setTimer( losLabels, 1500, 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 sr = getPlayerSerial() 
                guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
                guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
                guiSetText ( GUIEditor_Label[3], "Money : ".. money ) 
                guiSetText ( GUIEditor_Label[4], "Skin : ".. id ) 
                guiSetText ( GUIEditor_Label[6], "Dimension : ".. dm ) 
                guiSetText ( GUIEditor_Label[7], "Serial : "..tostring(sr) ) 
                     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 ) 

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

Estoy intentando averiguar tambien como poder dar refresh man, sakando mas o menos las funciones del panel de admin y para extraer los codigos hexadecimales. y la verdad man me interesa este script porq quiero agregarle una linea que muestre el nombre de user.

Mi server tiene clanes por acl y cada recluta debera saber el nombre de usuario del que quiera entrar o salir para poder aplicarlo al comando.

Si pillo algo te ayudo man

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

mira pille esto por ai cheka si sirve

function atualizarlista() 
    guiGridListClear(playerList) 
    for id, players in ipairs (getElementsByType("player")) do 
        local row = guiGridListAddRow(playerList) 
        guiGridListSetItemText(playerList, row, 1, unfuck(getPlayerName(players)), false, false) 
        guiGridListSetItemColor ( playerList, row, 1, 0, 250, 154, 255 ) 
    end 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), atualizarlista) 
addEventHandler("onClientPlayerQuit", getRootElement(), atualizarlista) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), atualizarlista) 
  

intenta adaptarla

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

si tambien me fije eso, voy a buscar la manera de arreglarlo, y me parece que tampoco te esta funcionando la IP

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

Si pero lo cambie por la serial para no complicarme tanto xD ahora mi codigo es asi

GUIEditor_Window = {} 
GUIEditor_Label = {} 
GUIEditor_Grid = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.2275,0.2367,0.5362,0.5533,"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[3] = guiCreateLabel(10,125,233,23,"Money : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[3],"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,255,233,23,"Serial : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[7],"clear-normal") 
GUIEditor_Label[8] = guiCreateLabel(10,287,233,23,"Team : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[7],"clear-normal") 
  
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]) 
    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 
addEventHandler("onClientPlayerJoin", getRootElement(), atualizarlista) 
addEventHandler("onClientPlayerQuit", getRootElement(), atualizarlista) 
addEventHandler("onClientPlayerChangeNick", getRootElement(), atualizarlista) 
addEventHandler("onClientResourceStart", getRootElement(), atualizarlista) 
  
  
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 sr = getPlayerSerial() 
                local tm1 = getPlayerTeam( thePlayer ) 
                local tm2 = getTeamName( tm1 ) 
                guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
                guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
                guiSetText ( GUIEditor_Label[3], "Money : ".. money ) 
                guiSetText ( GUIEditor_Label[4], "Skin : ".. id ) 
                guiSetText ( GUIEditor_Label[6], "Dimension : ".. dm ) 
                guiSetText ( GUIEditor_Label[7], "Serial : "..tostring(sr) ) 
                guiSetText ( GUIEditor_Label[8], "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 ) 

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

1: No hagas dos post seguidos, edita el anterior.

2: getPlayerMoney client side solo obtiene el dinero del cliente, no sirve para jugadores remotos.

3: Podes enviar a los jugadores desde el server side al client side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Tampoco, vos podes saber si soporta un jugador remoto en la wiki:

https://wiki.multitheftauto.com/wiki/GetPlayerSerial

Fijate que dice los argumentos para el server y el client side.

En el client side solo dice:

string getPlayerSerial ( ) 

Y en el server side dice:

string getPlayerSerial ( player thePlayer ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

@ElMota

Incluyendo tus derechos de autor

yo estaba modificando uno ami modo, y bueno tenia algo asi, solid nose que falla, nose si sera el trigger o algo

Clientside

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 id = getElementModel( thePlayer ) 
                local tm1 = getPlayerTeam( thePlayer ) 
                local tm2 = getTeamName( tm1 ) 
        triggerServerEvent( "getUn", getLocalPlayer(), thePlayer ) 
        triggerServerEvent( "getMon", getLocalPlayer(), thePlayer ) 
        triggerServerEvent( "getSer", getLocalPlayer(), thePlayer ) 
                guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
                guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
                guiSetText ( GUIEditor_Label[3], "Money : ".. money ) 
                guiSetText ( GUIEditor_Label[4], "Skin : ".. id ) 
                guiSetText ( GUIEditor_Label[5], "Serial : ".. theSerial ) 
                guiSetText ( GUIEditor_Label[6], "Team : ".. tm2 ) 
                guiSetText ( GUIEditor_Label[7], "Username : ".. un )    
            end 
        end 
    end 
end 
addEventHandler ( "onClientGUIDoubleClick", root, setStats ) 

Server

function getUN(thePlayer) 
local un = getAccountName ( thePlayer ) 
end 
addEvent("getUN", true) 
addEventHandler("getUN", getRootElement(), getUN) 
  
function getMon(thePlayer) 
local money = getPlayerMoney(thePlayer)  
end 
addEvent("getMon", true) 
addEventHandler("getMon", getRootElement(), getMon) 
  
function getSer(thePlayer) 
local theSerial = getPlayerSerial( thePlayer ) 
end 
addEvent("getSer", true) 
addEventHandler("getSer", getRootElement(), getSer) 

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

nomas me muestra el nombre y la localidad :/ y si, acabo de probar con source

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

Posted

por esa razon es q casi nunca triggeo :/

Buee y he aqui como finalmnete me qdo en script *-*

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[8] = guiCreateLabel(10,125,233,23,"Team : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[7],"clear-normal") 
GUIEditor_Label[8] = guiCreateLabel(10,125,233,23,"Team : \"\"",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[7],"clear-normal") 
  
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[8], "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 ) 

:D

elMota/elFoReX De Vuelta En MTA *---------*

Cuenta De Youtube En La Que Subo Tutoriales Acerca De MTA :3

https://www.youtube.com/user/KillersGPs

430x73_FFFFFF_FF9900_000000_000000.png
Posted

triggear desde client a server? y desde server a client?? :S jamas habia hecho eso

Actual Nick: [XGN]BorderLine

Actual Clan: XLatino

Actual Status: Staff, Mod Level 1

(BOSS)Yakuza - [vS]Yakuza - [sXE]Yakuza - [uG]Yakuza - [FTLS]Racing - [XGN]Borderline

  • Recently Browsing   0 members

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