GerardWay Posted February 2, 2013 Share Posted February 2, 2013 (edited) DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS DELETE THIS Edited February 8, 2013 by Guest Link to comment
Puma Posted February 2, 2013 Share Posted February 2, 2013 Last line of clientside script: "onPlayerJoin" Should be "onClientPlayerJoin" Remember this: All default clientside events have CLIENT in their name. Link to comment
Castillo Posted February 2, 2013 Share Posted February 2, 2013 "onClientPlayerJoin" is triggered when a remote player joins, it does not trigger to the local player. Link to comment
Puma Posted February 2, 2013 Share Posted February 2, 2013 Well, he said "when A player joins" so that would be not the player itself. Link to comment
Castillo Posted February 2, 2013 Share Posted February 2, 2013 Seeing that it's a spawn screen, I would say that it's meant for the player that joined, not for when a remote joins. @Zombie: Show it when resource starts. Link to comment
GerardWay Posted February 3, 2013 Author Share Posted February 3, 2013 It doesnt start when I start the resource either Castillo, so there must be a massive bug located somewhere in the script. When I actually execute the script, it does not output any errors to the console and simply appears as: Start: Requested by Console Starting Spawn Start: Resource Spawn started Link to comment
igthomas Posted February 3, 2013 Share Posted February 3, 2013 Try this Server: addEvent( "Sniper", true) addEventHandler( "Sniper", root, function() setElementPosition ( source, 0, 0, 5 ) end ) addEventHandler ( "onPlayerJoin", root, function ( ) triggerClientEvent ( source, "setSpawnVisible", source, true ) end ) Client: GUIEditor_button = {} GUIEditor_window = {} addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor_window[1] = guiCreateWindow(0, 0, 1365, 767, "Spawn", false) guiWindowSetSizable(GUIEditor_window[1], false) guiSetAlpha(GUIEditor_window[1], 1.00) Sniper = guiCreateButton(73, 121, 301, 93, "Sniper", false, GUIEditor_window[1]) guiSetFont(Sniper, "sa-header") GUIEditor_button[3] = guiCreateButton(73, 244, 301, 93, "Assault Unit", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[3], "sa-header") GUIEditor_button[4] = guiCreateButton(421, 121, 301, 93, "Mafia Hitman", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[4], "sa-header") GUIEditor_button[6] = guiCreateButton(421, 243, 301, 93, "Robber", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[6], "sa-header") GUIEditor_button[7] = guiCreateButton(776, 121, 301, 93, "News Reporter", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[7], "sa-header") GUIEditor_button[8] = guiCreateButton(776, 243, 301, 93, "Mechanic", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[8], "sa-header") GUIEditor_button[9] = guiCreateButton(73, 473, 301, 93, "Pilot", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[9], "sa-header") GUIEditor_button[10] = guiCreateButton(499, 473, 301, 93, "Rescuer", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[10], "sa-header") GUIEditor_button[11] = guiCreateButton(499, 596, 301, 93, "Execution Squad", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[11], "sa-header") GUIEditor_button[12] = guiCreateButton(73, 596, 301, 93, "Air Officer", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[12], "sa-header") GUIEditor_button[13] = guiCreateButton(901, 483, 418, 179, "Spawn!", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[13], "sa-gothic") showCursor( true ) end ) addEventHandler("onClientRender", root, function() dxDrawText("Military Forces", 62, 32, 280, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Criminals", 476, 32, 694, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Civillians", 808, 32, 1026, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Air Force", 62, 380, 402, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Military Unit", 465, 380, 805, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) end ) showCursor( false ) addEventHandler("onClientGUIClick", root, function() if source == Sniper then triggerServerEvent("Sniper", localPlayer) elseif source == Hydra then triggerServerEvent("Hydra", localPlayer) elseif source == Chainsaw then triggerServerEvent("Chainsaw", localPlayer) elseif source == MP5 then triggerServerEvent("RPG", localPlayer) elseif source == NRG500 then triggerServerEvent("NRG500", localPlayer) elseif source == Close then guiSetVisible(GUIEditor_window[1], false) showCursor(false) elseif source == Rhino then triggerServerEvent("Rhino", localPlayer) elseif source == Hunter then triggerServerEvent("Hunter", localPlayer) elseif source == Maverick then triggerServerEvent("Maverick", localPlayer) elseif source == Safezone then triggerServerEvent("Safezone", localPlayer) elseif source == MP5 then triggerServerEvent("MP5", localPlayer) end end ) addEvent("setSpawnVisible",true) addEventHandler("setSpawnVisible",root, function () guiSetVisible( GUIEditor_window[1], true ) setTimer( function () showCursor( true ) end, 1000,1) end ) Link to comment
TAPL Posted February 3, 2013 Share Posted February 3, 2013 I created A Spawn Menu, but it isnt showing when A Player Joins Can anybody help please?Spawnc.lua: GUIEditor = { button = {}, window = {}, } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(0, 0, 1365, 767, "Spawn", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetAlpha(GUIEditor.window[1], 1.00) Sniper = guiCreateButton(73, 121, 301, 93, "Sniper", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "sa-header") GUIEditor.button[3] = guiCreateButton(73, 244, 301, 93, "Assault Unit", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "sa-header") GUIEditor.button[4] = guiCreateButton(421, 121, 301, 93, "Mafia Hitman", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[4], "sa-header") GUIEditor.button[6] = guiCreateButton(421, 243, 301, 93, "Robber", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[6], "sa-header") GUIEditor.button[7] = guiCreateButton(776, 121, 301, 93, "News Reporter", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[7], "sa-header") GUIEditor.button[8] = guiCreateButton(776, 243, 301, 93, "Mechanic", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[8], "sa-header") GUIEditor.button[9] = guiCreateButton(73, 473, 301, 93, "Pilot", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[9], "sa-header") GUIEditor.button[10] = guiCreateButton(499, 473, 301, 93, "Rescuer", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[10], "sa-header") GUIEditor.button[11] = guiCreateButton(499, 596, 301, 93, "Execution Squad", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[11], "sa-header") GUIEditor.button[12] = guiCreateButton(73, 596, 301, 93, "Air Officer", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[12], "sa-header") GUIEditor.button[13] = guiCreateButton(901, 483, 418, 179, "Spawn!", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[13], "sa-gothic") end ) addEventHandler("onClientRender", root, function() dxDrawText("Military Forces", 62, 32, 280, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Criminals", 476, 32, 694, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Civillians", 808, 32, 1026, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Air Force", 62, 380, 402, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Military Unit", 465, 380, 805, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) end ) showCursor( false ) addEventHandler("onClientGUIClick", root, function() if source == Sniper then triggerServerEvent("Sniper", localPlayer) elseif source == Hydra then triggerServerEvent("Hydra", localPlayer) elseif source == Chainsaw then triggerServerEvent("Chainsaw", localPlayer) elseif source == MP5 then triggerServerEvent("RPG", localPlayer) elseif source == NRG500 then triggerServerEvent("NRG500", localPlayer) elseif source == Close then guiSetVisible(GUIEditor.window[1], false) showCursor(false) elseif source == Rhino then triggerServerEvent("Rhino", localPlayer) elseif source == Hunter then triggerServerEvent("Hunter", localPlayer) elseif source == Maverick then triggerServerEvent("Maverick", localPlayer) elseif source == Safezone then triggerServerEvent("Safezone", localPlayer) elseif source == MP5 then triggerServerEvent("MP5", localPlayer) end end ) function showit ( ) guiSetVisible( GUIEditor.window[1], true ) showCursor( true ) end addEventHandler ("onPlayerJoin", getRootElement(), showit) Spawns.lua: addEvent( "Sniper", true) addEventHandler( "Sniper", root, function() setElementPosition ( source, 0, 0, 5 ) end ) Any help is appreciated! Nothings wrong other than the event "onPlayerJoin" is server side, and here GUI Editor.button[2] does not exist. guiSetFont(GUIEditor.button[2], "sa-header") And still the window should be showing when you start the resource/join the server. Maybe you have something wrong in the meta. Link to comment
GerardWay Posted February 3, 2013 Author Share Posted February 3, 2013 1. Thanks Tapl 2. Thanks Optimus/ighthomas EDIT: I tried to make the button "Spawn!" close the spawn panel, but it doesnt work Client: GUIEditor_button = {} GUIEditor_window = {} addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor_window[1] = guiCreateWindow(0, 0, 1365, 767, "Spawn", false) guiWindowSetSizable(GUIEditor_window[1], false) guiSetAlpha(GUIEditor_window[1], 1.00) Sniper = guiCreateButton(73, 121, 301, 93, "Sniper", false, GUIEditor_window[1]) guiSetFont(Sniper, "sa-header") GUIEditor_button[3] = guiCreateButton(73, 244, 301, 93, "Assault Unit", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[3], "sa-header") GUIEditor_button[4] = guiCreateButton(421, 121, 301, 93, "Mafia Hitman", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[4], "sa-header") GUIEditor_button[6] = guiCreateButton(421, 243, 301, 93, "Robber", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[6], "sa-header") GUIEditor_button[7] = guiCreateButton(776, 121, 301, 93, "News Reporter", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[7], "sa-header") GUIEditor_button[8] = guiCreateButton(776, 243, 301, 93, "Mechanic", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[8], "sa-header") GUIEditor_button[9] = guiCreateButton(73, 473, 301, 93, "Pilot", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[9], "sa-header") GUIEditor_button[10] = guiCreateButton(499, 473, 301, 93, "Rescuer", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[10], "sa-header") GUIEditor_button[11] = guiCreateButton(499, 596, 301, 93, "Execution Squad", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[11], "sa-header") GUIEditor_button[12] = guiCreateButton(73, 596, 301, 93, "Air Officer", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[12], "sa-header") Spawn = guiCreateButton(901, 483, 418, 179, "Spawn!", false, GUIEditor_window[1]) guiSetFont(Spawn, "sa-gothic") showCursor( true ) end ) addEventHandler("onClientRender", root, function() dxDrawText("Military Forces", 62, 32, 280, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Criminals", 476, 32, 694, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Civillians", 808, 32, 1026, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Air Force", 62, 380, 402, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Military Unit", 465, 380, 805, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) end ) showCursor( false ) addEventHandler("onClientGUIClick", root, function() if source == Sniper then triggerServerEvent("Sniper", localPlayer) elseif source == Spawn then guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end ) addEvent("setSpawnVisible",true) addEventHandler("setSpawnVisible",root, function () guiSetVisible( GUIEditor_window[1], true ) setTimer( function () showCursor( true ) end, 1000,1) end ) Link to comment
TAPL Posted February 3, 2013 Share Posted February 3, 2013 That's because your button has different name. GUIEditor.button[13] = guiCreateButton(901, 483, 418, 179, "Spawn!", false, GUIEditor.window[1]) It's GUIEditor.button[13] not Spawn. Link to comment
GerardWay Posted February 3, 2013 Author Share Posted February 3, 2013 In the more recent code I provided, I changed "GUIEditor.button[13]" To "Spawn" Link to comment
igthomas Posted February 3, 2013 Share Posted February 3, 2013 The problem with previous was that you had dots between "GUIEditor" and "window" instead of "_" so it gave some error. Here's for removing the spawnpanel: GUIEditor_button = {} GUIEditor_window = {} addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor_window[1] = guiCreateWindow(0, 0, 1365, 767, "Spawn", false) guiWindowSetSizable(GUIEditor_window[1], false) guiSetAlpha(GUIEditor_window[1], 1.00) Sniper = guiCreateButton(73, 121, 301, 93, "Sniper", false, GUIEditor_window[1]) guiSetFont(Sniper, "sa-header") GUIEditor_button[3] = guiCreateButton(73, 244, 301, 93, "Assault Unit", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[3], "sa-header") GUIEditor_button[4] = guiCreateButton(421, 121, 301, 93, "Mafia Hitman", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[4], "sa-header") GUIEditor_button[6] = guiCreateButton(421, 243, 301, 93, "Robber", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[6], "sa-header") GUIEditor_button[7] = guiCreateButton(776, 121, 301, 93, "News Reporter", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[7], "sa-header") GUIEditor_button[8] = guiCreateButton(776, 243, 301, 93, "Mechanic", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[8], "sa-header") GUIEditor_button[9] = guiCreateButton(73, 473, 301, 93, "Pilot", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[9], "sa-header") GUIEditor_button[10] = guiCreateButton(499, 473, 301, 93, "Rescuer", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[10], "sa-header") GUIEditor_button[11] = guiCreateButton(499, 596, 301, 93, "Execution Squad", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[11], "sa-header") GUIEditor_button[12] = guiCreateButton(73, 596, 301, 93, "Air Officer", false, GUIEditor_window[1]) guiSetFont(GUIEditor_button[12], "sa-header") Spawn = guiCreateButton(901, 483, 418, 179, "Spawn!", false, GUIEditor_window[1]) guiSetFont(Spawn, "sa-gothic") showCursor( true ) end ) function dxTexts() dxDrawText("Military Forces", 62, 32, 280, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Criminals", 476, 32, 694, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("Civillians", 808, 32, 1026, 142, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Air Force", 62, 380, 402, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) dxDrawText("U.S.S Military Unit", 465, 380, 805, 490, tocolor(255, 255, 255, 255), 4, "default", "left", "top", false, false, true, false, false) end addEventHandler("onClientRender", root, dxTexts) showCursor( false ) addEventHandler("onClientGUIClick", root, function() if source == Sniper then triggerServerEvent("Sniper", localPlayer) elseif source == Spawn then destroyElement(GUIEditor_window[1]) removeEventHandler("onClientRender", root, dxTexts) showCursor(false) end end ) addEvent("setSpawnVisible",true) addEventHandler("setSpawnVisible",root, function () guiSetVisible( GUIEditor_window[1], true ) setTimer( function () showCursor( true ) end, 1000,1) end ) Link to comment
GerardWay Posted February 3, 2013 Author Share Posted February 3, 2013 Thanks Optimus, everything going okay at ZO:R? EDIT: Now the Panel is back to not showing up again Link to comment
igthomas Posted February 3, 2013 Share Posted February 3, 2013 Weird I've just tested it and everything worked well you sure you haven't forgot anything in meta? Link to comment
GerardWay Posted February 3, 2013 Author Share Posted February 3, 2013 Hrmmm, let me check man EDIT: Meta.xml: <meta> <info author="Fontaine" type="script" version="1.3" name="Spawn" description="Spawn Menu" /> <script src="spawn.lua" type="client" /> <script src="spawns.lua" type="server" /> </meta> Link to comment
igthomas Posted February 4, 2013 Share Posted February 4, 2013 The problem could be because on your first post the client script file is called "Spawnc.lua" instead of "spawn.lua". I've tested it again and everything worked very well Link to comment
GerardWay Posted February 7, 2013 Author Share Posted February 7, 2013 Still not working, could you maybe provide me with the "Meta.XML" That you are using for this script please? Link to comment
Adistar Posted February 7, 2013 Share Posted February 7, 2013 You could try this. onPlayerSpawnButton Then enable it, so ("onPlayerSpawnButton", true) If you want to let the player spawn: addEvent("onPlayerSpawnButton", true) addEventHandler("onPlayerSpawnButton", getRootElement(), playerSpawn) Add this in serverside. Link to comment
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