Jump to content

help dude


Dim

Recommended Posts

Posted (edited)

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
Posted

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.

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

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?

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

P.S: Try to understand the script, I'll not give you the code always.

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.

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