iFoReX Posted April 23, 2012 Posted April 23, 2012 I done it code but I dont know how set the texts 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)
DNL291 Posted April 24, 2012 Posted April 24, 2012 column = guiGridListAddColumn(GUIEditor_Grid[1],"Jugadores",0.80) guiSetText( GUIEditor_Label[1], "Nickname : "..playername"" )
Castillo Posted April 24, 2012 Posted April 24, 2012 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 )
iFoReX Posted April 24, 2012 Author Posted April 24, 2012 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 )
Castillo Posted April 24, 2012 Posted April 24, 2012 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 )
iFoReX Posted April 24, 2012 Author Posted April 24, 2012 thnx solid work but now Doesnt work getPlayerIP 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
Castillo Posted April 24, 2012 Posted April 24, 2012 You must trigger "thePlayer" argument too, and then trigger back using triggerClientEvent.
iFoReX Posted April 24, 2012 Author Posted April 24, 2012 I never trigger with triggerClientEvent please help me to do it and how trigger thePlayer ? I dont know how trigger arguments
Castillo Posted April 24, 2012 Posted April 24, 2012 triggerServerEvent( "getIP", getLocalPlayer() ) After getLocalPlayer ( ) add thePlayer. triggerClientEvent works the same as triggerServerEvent.
iFoReX Posted April 24, 2012 Author Posted April 24, 2012 here a image of the problem I done add argument "thePlayer"
Castillo Posted April 24, 2012 Posted April 24, 2012 You must add the resource to the ACL group "Admin".
iFoReX Posted April 24, 2012 Author Posted April 24, 2012 I added to ACL the Resource but again the IP cant get
iFoReX Posted April 24, 2012 Author Posted April 24, 2012 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)
Castillo Posted April 24, 2012 Posted April 24, 2012 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.
iFoReX Posted April 24, 2012 Author Posted April 24, 2012 Ok solid thnx you now When a new player connect, how I can refresh the gridlist ?
BorderLine Posted April 24, 2012 Posted April 24, 2012 addEventHandler ( "onClientResourceStart", resourceRoot, losLabels ) addEventHandler ( "onClientPlayerJoin", resourceRoot, losLabels ) addEventHandler ( "onClientPlayerQuit", resourceRoot, losLabels ) addEventHandler ( "onClientPlayerChangeNick", resourceRoot, losLabels )
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now