Jump to content

Как открыть GUI окно игроку при Коннекте на сервер?


Recommended Posts

У меня никак не получаеться сделать что-бы GUI окно открывалось при заходе игрока на сервер (Открывалось только для зашедшего)

Вот примерно что я попытался написать:

Первый вариант(через Client скрипт):

function openWDW() 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
  
GUIEditor_Window[1] = guiCreateWindow(0.0313,0.5352,0.2314,0.4362,"Special groups spawn Menu",true) 
btnAdmins = guiCreateButton(0.2025,0.0836,0.5738,0.0836,"Admins",true,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[1],"default-bold-small") 
btnRangers = guiCreateButton(0.2025,0.2179,0.5738,0.0836,"Rangers",true,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Button[2],"default-bold-small") 
guiSetVisible(GUIEditor_Window[1], true) 
  
  
wdwWarning = guiCreateWindow(0.376,0.2474,0.3379,0.3476,"WARNING",true) 
memoWarning = guiCreateMemo(0.0289,0.0864,0.9393,0.8642,"You cant spawn as this group!",true,wdwWarning) 
guiMemoSetReadOnly(memoWarning,true) 
btnOK = guiCreateButton(0.4133,0.8764,0.1532,0.0899,"OK",true,wdwWarning) 
guiSetVisible(wdwWarning, false) 
end 
addEventHandler("onClientPlayerJoin", getRootElement(), openWDW) 

Второй вариант (через Server script):

function openstupidWindow() 
        triggerServerEvent ("openWDW",getRootElement())) 
end 
addEventHandler("onPlayerJoin",getRootElement(),openstupidWindow) 

Link to comment

Клиент

GUIEditor_Window = {} 
GUIEditor_Button = {} 
     
function openWDW( )  
    GUIEditor_Window[1] = guiCreateWindow( 0.0313,0.5352,0.2314,0.4362,"Special groups spawn Menu",true ) 
    btnAdmins = guiCreateButton( 0.2025,0.0836,0.5738,0.0836,"Admins",true,GUIEditor_Window[1] ) 
    guiSetFont( GUIEditor_Button[1],"default-bold-small" ) 
    btnRangers = guiCreateButton( 0.2025,0.2179,0.5738,0.0836,"Rangers",true,GUIEditor_Window[1] ) 
    guiSetFont( GUIEditor_Button[2],"default-bold-small" ) 
    guiSetVisible( GUIEditor_Window[1], true ) 
      
      
    wdwWarning = guiCreateWindow( 0.376,0.2474,0.3379,0.3476,"WARNING",true ) 
    memoWarning = guiCreateMemo( 0.0289,0.0864,0.9393,0.8642,"You cant spawn as this group!",true,wdwWarning ) 
    guiMemoSetReadOnly( memoWarning,true ) 
    btnOK = guiCreateButton( 0.4133,0.8764,0.1532,0.0899,"OK",true,wdwWarning ) 
    guiSetVisible( wdwWarning, false ) 
end 
addEventHandler( "onClientResourceStart", resourceRoot, openWDW ) 

Ты не можешь использовать onPlayerJoin т.к событие срабатывает быстрее клиента.

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