Jump to content

][ استفسار ][ getServerName


Recommended Posts

6 minutes ago, KillerX said:

triggerServerEvent + getServerName

 

-- كيلنت
local text = "server name: " triggerServerEvent ( "ServerName", resourceRoot, name )
window = guiCreateWindow(413, 103, 544, 596, text, false)

-- سيرفر
function outputServerName ( )
	local name = getServerName( )
	name =  getServerName( )
end
addEvent( "ServerName", true )
addEventHandler( "ServerName", resourceRoot, outputServerName )

 

الوحة تشتغل و كل شي يشتغل بس اسم السيرفر ما يشتغل

+ debug ما يقول شي

Link to comment
addEventHandler ( "onClientResourceStart" , resourceRoot , function ( ) 
wnd = guiCreateWindow ( 413, 103, 544, 596, "", false )
triggerServerEvent ( "getServer:Name" , localPlayer )
end )

addEvent ( "setServer:Name" , true )
addEventHandler ( "setServer:Name" , root , function ( name )
guiSetText ( wnd , tostring ( name ) ) 
end )


--- Server

addEvent ( "getServer:Name" , true )
addEventHandler ( "getServer:Name" , root , function (  )
triggerClientEvent ( source , "setServer:Name" , source , getServerName ( ) )
end ) 

 

  • Thanks 1
Link to comment
9 hours ago, Hakan said:

addEventHandler ( "onClientResourceStart" , resourceRoot , function ( ) 
wnd = guiCreateWindow ( 413, 103, 544, 596, "", false )
triggerServerEvent ( "getServer:Name" , localPlayer )
end )

addEvent ( "setServer:Name" , true )
addEventHandler ( "setServer:Name" , root , function ( name )
guiSetText ( wnd , tostring ( name ) ) 
end )


--- Server

addEvent ( "getServer:Name" , true )
addEventHandler ( "getServer:Name" , root , function (  )
triggerClientEvent ( source , "setServer:Name" , source , getServerName ( ) )
end ) 

 

اقدر احط في اليفينت حق السيرفر فاكشنين

يعني

triggerClientEvent ( source , "setServer:Players" , source , getMaxPlayers ( ) )
 
كيليت
 
addEvent ( "setServer:Name" , true )
addEventHandler ( "setServer:Name" , root , function ( name,Players )
guiSetText ( window , "Server Name: "..tostring ( name ).."Players: ".. tostring( #players ) .. "/"..tostring(Players))
end )
Link to comment

triggerServerEvent ( "getServer:Name" , localPlayer )

addEvent ( "setServer:Name" , true )
function TitleWindow( name )
guiSetText ( window , "Server Name: "..tostring ( name ).."  Players: ".. tostring( #players ) .. "/")
end
addEventHandler( "setServer:Name", root, TitleWindow ) 

--server

addEvent ( "getServer:Name" , true )
addEventHandler ( "getServer:Name" , root , function (  )
triggerClientEvent ( source , "setServer:Name" , source , getServerName ( ) )
end ) 

انا ابي اضيف في الفاكشن ذا getMaxPlayers

Link to comment
addEvent ( "getServer:Name" , true )
addEventHandler ( "getServer:Name" , root , function (  )
triggerClientEvent ( source , "setServer:Name" , source ,table.concat({getServerName( ),'Players : '..getMaxPlayers ( )},','))
end ) 
triggerServerEvent ( "getServer:Name" , localPlayer )

addEvent ( "setServer:Name" , true )
function TitleWindow( name )
guiSetText ( window , "Server Name: "..name )
end
addEventHandler( "setServer:Name", root, TitleWindow ) 

 

Link to comment
13 minutes ago, salh said:

شكرا اشتغل الكود بس ممكن سؤول

function TitleWindow( name )

name

من وين عرفتها؟

دا متغير عادي عشان احط اسم السيرفر باللوحه اللي جلبناه من ملف السيرفر بالترايقر

  • Thanks 1
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...