Jump to content

why I cant guiSetText :S


iFoReX

Recommended Posts

Posted

I done it code but I dont know how set the texts :S

here the code

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]) 
guiGridListSetSelectionMode(GUIEditor_Grid[1],2) 
  
column = guiGridListAddColumn(GUIEditor_Grid[1],"Jugadores",0.-- s8) -->
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,"IP : \"\"",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  
                        row = guiGridListAddRow ( GUIEditor_Grid[1] ) 
                        guiGridListSetItemText ( GUIEditor_Grid[1], row, column, getPlayerName ( playeritem ), false, false ) 
                end 
        end 
end 
addEventHandler ( "onClientResourceStart", getRootElement(), losLabels) 
  
function setStats() 
if source == GUIEditor_Grid[1] then 
   local playername = guiGridListSetItemText( GUIEditor_Grid[1], row, column ) 
guiSetText( GUIEditor_Label[1], "Nickname : "..playername" ) 
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
column = guiGridListAddColumn(GUIEditor_Grid[1],"Jugadores",0.80) 

guiSetText( GUIEditor_Label[1], "Nickname : "..playername"" ) 

Please do not PM me with scripting related question nor support, use the forums instead.

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,"IP : \"\"",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 ) 
  
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 ) 
            guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
        end 
    end 
end 
addEventHandler ( "onClientGUIDoubleClick", root, setStats ) 

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

Copy my code again, I've fixed a problem.

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

thnx now work but now I cant get the Zone Map

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 x,y,z = getElementPosition( playername ) 
            local location = getZoneName ( x,y,z ) 
            guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
            guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
        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

You must use the function: getPlayerFromName to get the player element from it's name.

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 ) 
                guiSetText ( GUIEditor_Label[1], "Nickname : ".. playername ) 
                guiSetText ( GUIEditor_Label[2], "Location : ".. location ) 
            end 
        end 
    end 
end 
addEventHandler ( "onClientGUIDoubleClick", root, setStats ) 

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

thnx solid work but now Doesnt work getPlayerIP :S here my code

cl-side

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,"IP : \"\"",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 ) 
  
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 ) 
                triggerServerEvent( "getIP", getLocalPlayer() ) 
                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], "IP : ".. ip ) 
                     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 ) 

sv-side

function getIP( thePlayer ) 
local ip = getPlayerIP( thePlayer ) 
end 
addEvent("getIP", true) 
addEventHandler("getIP", getRootElement(), getIP) 

why doesnt work :S

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
triggerServerEvent( "getIP", getLocalPlayer() ) 

After getLocalPlayer ( ) add thePlayer.

triggerClientEvent works the same as triggerServerEvent.

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

You must add the resource to the ACL group "Admin".

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

Post your script ( client and server ) 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

cl-side

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,"IP : \"\"",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 ) 
  
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 ) 
                triggerServerEvent( "getIP", 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[6], "Dimension : ".. dm ) 
                guiSetText ( GUIEditor_Label[7], "IP : ".. ip ) 
                     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 ) 

sv-side

function getIP( thePlayer ) 
local ip = getPlayerIP( thePlayer ) 
end 
addEvent("getIP", true) 
addEventHandler("getIP", getRootElement(), getIP) 

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

First:

Remove:

guiSetText ( GUIEditor_Label[7], "IP : ".. ip ) 

Second:

Use triggerClientEvent to trigger the IP to the client side.

Third:

Add the events client side and then use:

guiSetText ( GUIEditor_Label[7], "IP : ".. ip ) 

with the value sent from server 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
addEventHandler ( "onClientResourceStart", resourceRoot, losLabels ) 
addEventHandler ( "onClientPlayerJoin", resourceRoot, losLabels ) 
addEventHandler ( "onClientPlayerQuit", resourceRoot, losLabels ) 
addEventHandler ( "onClientPlayerChangeNick", resourceRoot, losLabels ) 

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

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