toptional Posted January 27, 2013 Posted January 27, 2013 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 )
MR.S3D Posted January 27, 2013 Posted January 27, 2013 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 )
toptional Posted January 27, 2013 Author Posted January 27, 2013 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
Lloyd Logan Posted January 27, 2013 Posted January 27, 2013 Thats because you have onClientRender, change that.
toptional Posted January 27, 2013 Author Posted January 27, 2013 Thats because you have onClientRender, change that. dxText needs onClientRender
MR.S3D Posted January 27, 2013 Posted January 27, 2013 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
Lloyd Logan Posted January 27, 2013 Posted January 27, 2013 Thats because you have onClientRender, change that. dxText needs onClientRender I know, I mean change that just like the way MR.S3D has done.
toptional Posted January 27, 2013 Author Posted January 27, 2013 I'm rather confused, mind putting it all together?
Lloyd Logan Posted January 27, 2013 Posted January 27, 2013 I'm rather confused, mind putting it all together? Do you wan't it shown when the Login, or join for the dxDrawText?
MR.S3D Posted January 27, 2013 Posted January 27, 2013 addEventHandler("onClientRender", root showRender) --- To show dx removeEventHandler("onClientRender", root showRender) --- to remvoe dx
toptional Posted January 27, 2013 Author Posted January 27, 2013 I'm rather confused, mind putting it all together? Do you wan't it shown when the Login, or join for the dxDrawText? i want the dx stuff the gui stuff all to show when the player logins!
Castillo Posted January 27, 2013 Posted January 27, 2013 -- 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 )
toptional Posted January 28, 2013 Author Posted January 28, 2013 I get these 2 errors WARNING : Loading scripted failed AP_Spawn\client.lua:22: ')' expected near 'showRender' ERROR: server triggered clientside event showSpawnWindow, but event is not added clientside
toptional Posted January 28, 2013 Author Posted January 28, 2013 Copy the client side again. It works! Perfect Thanks
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