Jump to content

help dude


Dim

Recommended Posts

How do I get name server in client

:lol::D:):(:o:shock::?:x:lol::evil::twisted::|:mrgreen::fadein::redhotevil::arrowup:

  
GUIEditor_Window = {} 
GUIEditor_Label = {} 
  
GUIEditor_Window[1] = guiCreateWindow(262,309,315,265,"",false) 
ServerNameLabel = guiCreateLabel(0.2825,0.1358,0.3587,0.1132,"name",true,GUIEditor_Window[1]) 
  
function onresourceStart () 
  bindKey ("p", "down", dude) 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) 
  
function dude () 
    guiSetVisible (GUIEditor_Window[1], true) 
    showCursor (true) 
local nameserver = getServerName( ) 
    guiSetText ( ServerNameLabel, "Name: [ " .. nameserver .. " ]" ) 
end 

Edited by Guest
Link to comment

Firstly, stop spamming to get attention, that's not the way this works.

Second, you are messing client & server functions in one script, that'll never work, you need triggers.

-- client side

GUIEditor_Window = {} 
GUIEditor_Label = {} 
  
GUIEditor_Window[1] = guiCreateWindow(262,309,315,265,"",false) 
ServerNameLabel = guiCreateLabel(0.2825,0.1358,0.3587,0.1132,"name",true,GUIEditor_Window[1]) 
  
function onresourceStart () 
  bindKey ("p", "down", dude) 
end 
addEventHandler("onClientResourceStart", resourceRoot, onresourceStart) 
  
function dude () 
    guiSetVisible (GUIEditor_Window[1], true) 
    showCursor (true) 
    triggerServerEvent("getServerName",localPlayer,localPlayer) 
end 
  
addEvent("returnServerName",true) 
addEventHandler("returnServerName",root, 
function (serverName) 
    guiSetText ( ServerNameLabel, "Name: [ " .. tostring(serverName) .. " ]" ) 
end) 

-- server side

addEvent("getServerName",true) 
addEventHandler("getServerName",root, 
function (client) 
    local serverName = getServerName( ) 
    triggerClientEvent(client,"returnServerName",client,serverName) 
end) 

Should work.

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