Jump to content

onPlayerLogin showgui&dx


toptional

Recommended Posts

WIth this script, i'm trying to get when a player logs in to the server the gui and the dx line and dx text shows

It's not working getting no errors

addEventHandler("onPlayerLogin", root, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
        guiWindowSetSizable(GUIEditor.window[1], true) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
        GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
        guiEditSetReadOnly(GUIEditor.edit[1], true) 
        GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "sa-gothic")     
        addEventHandler("onClientRender", root, 
    function  ()  
        dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
    end 
) 
  
    end 
) 
  
  
  

Link to comment

Server

  
  
addEventHandler( 'onPlayerLogin', root,  
    function( _, acc ) 
            triggerClientEvent(source,"ShowLoginWindow",source) 
    end  
) 
  
  
  

Client

  
  
GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
         
addEvent("ShowLoginWindow", true) 
addEventHandler("ShowLoginWindow", root, 
    function()       
        guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        showCursor(guiGetVisible(GUIEditor.window[1])) 
    end 
) 
  
addEventHandler("onClientRender", root, 
    function  () 
        dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
    end 
) 
  
  

Link to comment
Server
  
  
addEventHandler( 'onPlayerLogin', root,  
    function( _, acc ) 
            triggerClientEvent(source,"ShowLoginWindow",source) 
    end  
) 
  
  
  

Client

  
  
GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
         
addEvent("ShowLoginWindow", true) 
addEventHandler("ShowLoginWindow", root, 
    function()       
        guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        showCursor(guiGetVisible(GUIEditor.window[1])) 
    end 
) 
  
addEventHandler("onClientRender", root, 
    function  () 
        dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
        dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
        dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
    end 
) 
  
  

Thanks but the dxDrawLine and dxDrawText shows as soon as the resource starts, but the gui stuff shows when you login

Link to comment
  
GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        
addEvent("ShowLoginWindow", true) 
addEventHandler("ShowLoginWindow", root, 
    function()      
        guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        showCursor(guiGetVisible(GUIEditor.window[1])) 
    end 
) 
  
function showRender() 
    dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
    dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
end 
  
  
  

Use this

  
  
addEventHandler("onClientRender", root showRender) --- To show dx 
removeEventHandler("onClientRender", root showRender) --- to remvoe 

Link to comment

-- client side:

GUIEditor = { 
window = {}, 
edit = {}, 
button = {}, 
} 
  
GUIEditor.window[1] = guiCreateWindow(0, 0, 763, 741, "Zombie Apocalypse Spawn Menu", true) 
guiWindowSetSizable(GUIEditor.window[1], true) 
guiSetAlpha(GUIEditor.window[1], 1.00) 
GUIEditor.edit[1] = guiCreateEdit(1008, 588, 322, 137, "Class Information:", true, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.edit[1], "NormalTextColour", "FFAB0000") 
guiEditSetReadOnly(GUIEditor.edit[1], true) 
GUIEditor.button[2] = guiCreateButton(152, 626, 455, 105, "Spawn", true, GUIEditor.window[1]) 
guiSetFont(GUIEditor.button[2], "sa-gothic")   
guiSetVisible(GUIEditor.window[1], not guiGetVisible(GUIEditor.window[1])) 
        
addEvent("showSpawnWindow", true) 
addEventHandler("showSpawnWindow", root, 
    function()     
        guiSetVisible(GUIEditor.window[1], true) 
        showCursor(true) 
        addEventHandler("onClientRender", root, showRender) 
    end 
) 
  
function showRender() 
    dxDrawText("Class", 518, 99, 671, 144, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawText("", 615, 411, 618, 411, tocolor(255, 255, 255, 255), 2, "default", "left", "top", false, false, true, false, false) 
    dxDrawText("Category", 51, 89, 255, 158, tocolor(255, 255, 255, 255), 2, "pricedown", "left", "top", false, false, true, false, false) 
    dxDrawLine(391, 71, 391, 626, tocolor(255, 255, 255, 255), 1, true) 
end 

-- server side:

addEventHandler ( "onPlayerLogin", root, 
    function ( ) 
        triggerClientEvent ( source, "showSpawnWindow", source ) 
    end 
) 

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