Jump to content

[HELP] I cant get IP address


Seba500PLK

Recommended Posts

Hi, i cant get ip address

CLIENT:

  
    function ButtonSel(button, state, absoluteX, absoluteY,player,ip) 
    if (source == button) then 
         
        guiSetText ( aTab1.Name, "IP: "..ip) 
         
         
         
         
        triggerServerEvent('event1',localPlayer,guiGridListGetItemText ( aTab1.PlayerList, guiGridListGetSelectedItem ( aTab1.PlayerList ), column ),localPlayer) 
         
        end 
    end 
  
  
addEvent( "ToClient", true ) 
addEventHandler( "ToClient", localPlayer, ButtonWybierz ) 
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),ButtonWybierz) 
  

SERVER:

  
addEvent('event1',true) 
addEventHandler('event1',root, 
    function(event1, player) 
     
triggerClientEvent ( player, "ToClient",player, getPlayerIP(player) ) 
         
  
    end 
     
) 
  

Link to comment
I need to know how this ordered the gui.
  
function openGui() 
local x, y = guiGetScreenSize() 
window = guiCreateWindow(x / 2 - 310, y / 2 - 260, 620, 520, "Panel Admina", false) 
guiWindowSetSizable ( window , false ) 
guiSetVisible(window ,false) 
  
TabPanel = guiCreateTabPanel ( 0.01, 0.05, 0.98, 0.95, true, window ) 
aTab1 = {}   
aTab1.Tab = guiCreateTab ( "Players", TabPanel, "players" ) 
  
  
    aTab1.PlayerList = guiCreateGridList ( 0.03, 0.10, 0.20, 0.83, true, aTab1.Tab ) 
    local column = guiGridListAddColumn( aTab1.PlayerList, "Player", 0.85 ) 
    if ( column ) then --If the column has been created, fill it with players 
        for id, player in ipairs(getElementsByType("player")) do 
            local row = guiGridListAddRow ( aTab1.PlayerList ) 
            guiGridListSetItemText ( aTab1.PlayerList, row, column, getPlayerName ( player ), false, false ) 
        end 
    end          
  
  
  
aTab1.IP = guiCreateLabel ( 0.26, 0.13, 0.30, 0.035, "IP: ", true, aTab1.Tab ) 
  
buttonSel = guiCreateButton(416, 263, 92, 17, "Select", false, aTab1.Tab) 
end 
  
  
  function ButtonSel(button, state, absoluteX, absoluteY,player,ip) 
    if (source == button) then 
        
        guiSetText ( aTab1.Name, "IP: "..ip) 
        
        
        
        
        triggerServerEvent('event1',localPlayer,guiGridListGetItemText ( aTab1.PlayerList, guiGridListGetSelectedItem ( aTab1.PlayerList ), column ),localPlayer) 
        
        end 
    end 
  
  
addEvent( "ToClient", true ) 
addEventHandler( "ToClient", localPlayer, ButtonSel) 
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),ButtonSel) 
  

Link to comment
Hi, i cant get ip address

CLIENT:

  
    function ButtonSel(button, state, absoluteX, absoluteY,player,ip) 
    if (source == button) then 
         
        guiSetText ( aTab1.Name, "IP: "..ip) 
         
         
         
         
        triggerServerEvent('event1',localPlayer,guiGridListGetItemText ( aTab1.PlayerList, guiGridListGetSelectedItem ( aTab1.PlayerList ), column ),localPlayer) 
         
        end 
    end 
  
  
addEvent( "ToClient", true ) 
addEventHandler( "ToClient", localPlayer, ButtonWybierz ) 
addEventHandler ( "onClientGUIClick", getResourceRootElement(getThisResource()),ButtonWybierz) 
  

SERVER:

  
addEvent('event1',true) 
addEventHandler('event1',root, 
    function(event1, player) 
     
triggerClientEvent ( player, "ToClient",player, getPlayerIP(player) ) 
         
  
    end 
     
) 
  

You're doing it wrong (not sure why neargreen asked the code, if he didnt actually readed what you posted).

You are triggering the event over itself, over and over, but then asking for arguments in a part where they dont exist.

Also, next time, use debugscript before asking for help, becouse it would obviously have outputted that IP doesnt exist.

And last, i'm just saving this part of the code, the rest you did has no logic at all. (At least ButtonSel function)

Server:

  
addEvent('event1',true) 
addEventHandler('event1',root, 
    function(selected, player) 
     
triggerClientEvent (client, "ToClient",resourceRoot, getPlayerIP(client) ) 
         
  
    end 
     
) 
  

Client:

  
    function ButtonSel(button, state, absoluteX, absoluteY,player,ip) 
    if (source == button) then 
         
        guiSetText ( aTab1.Name, "IP: "..ip) 
         
         
         
         
        triggerServerEvent('event1',localPlayer,guiGridListGetItemText ( aTab1.PlayerList, guiGridListGetSelectedItem ( aTab1.PlayerList ), column ),localPlayer) 
         
        end 
    end 
  
function Whatever(ip) 
aTab1.Name = "IP: "..ip 
end 
  
addEvent( "ToClient", true ) 
addEventHandler( "ToClient", localPlayer,Whatever ) 

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