Dim Posted September 13, 2011 Share Posted September 13, 2011 (edited) How do I get name server in client 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 September 13, 2011 by Guest Link to comment
Cadu12 Posted September 13, 2011 Share Posted September 13, 2011 getServerName server-side only Link to comment
Castillo Posted September 13, 2011 Share Posted September 13, 2011 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
Dim Posted September 13, 2011 Author Share Posted September 13, 2011 crazy trigger you fuck I mean you crazy how doing that Link to comment
Castillo Posted September 13, 2011 Share Posted September 13, 2011 I'm not crazy, triggers are used for this kind of script. P.S: Have you tested it? do you know how to setup a client and a server side script? Link to comment
Dim Posted September 13, 2011 Author Share Posted September 13, 2011 Yes it working But I liked this craziness script Thanks, man! Link to comment
Castillo Posted September 13, 2011 Share Posted September 13, 2011 You welcome. P.S: Try to understand the script, I'll not give you the code always. Link to comment
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