Bean666 Posted January 11, 2015 Share Posted January 11, 2015 hi, i've been working on my pickup system, when a player clicks the button it gives him a weapon and destroys the marker... is there anyway to let this marker respawn for some time? any help appreciated Code: client.lua local marker = createMarker( -1200.4541015625, -1035.0224609375, 129.1569519043, "Cylinder", 2, 255, 200, 0, 255) GUIEditor = { button = {}, window = {}, label = {}, memo = {} } GUIEditor.window[1] = guiCreateWindow(435, 236, 394, 317, "Dead Soldier Inventory", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(124, 109, 142, 72, "M4", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(130, 260, 136, 47, "Close", false, GUIEditor.window[1]) addEventHandler("onClientMarkerHit", marker, function(player) if (player == localPlayer) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end) addEventHandler("onClientGUIClick",GUIEditor.button[2],function() if ( source == GUIEditor.button[2]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) addEventHandler("onClientGUIClick",GUIEditor.button[1],function() if ( source == GUIEditor.button[1]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) destroyElement(marker) triggerServerEvent("giveweaponM4", root) end end ) Server.lua function giveweaponM4 (thePlayer) -- Theme --giveWeapon (thePlayer, weaponID, ammo) giveWeapon ( source, 31, 150 ) -- takePlayerMoney (thePlayer, price) outputChatBox("You Have Picked up an M4!",thePlayer, 0,255,0) end addCommandHandler("M4", giveweaponM4) addEvent("giveweaponM4", true) addEventHandler("giveweaponM4", resourceRoot, giveweaponM4) Link to comment
Et-win Posted January 11, 2015 Share Posted January 11, 2015 markerTable = { --[[Marker1: ]]{-1200.4541015625, -1035.0224609375, 129.1569519043, "Cylinder", 2, 255, 200, 0, 255}, --More markers if you want. } --Create/Respawn our marker in 5 seconds setTimer(function() marker1 = createMarker(markerTable[1][1], markerTable[1][2], markerTable[1][3], markerTable[1][4], markerTable[1][5], markerTable[1][6], markerTable[1][7], markerTable[1][8], markerTable[1][9]) end, 5000, 1) Link to comment
Bean666 Posted January 11, 2015 Author Share Posted January 11, 2015 where will i add this in the server.lua or in the client? Link to comment
Bean666 Posted January 11, 2015 Author Share Posted January 11, 2015 it worked or it respawns. . but when i step on the marker that respawned, GUI Doesnt show up. Link to comment
Et-win Posted January 11, 2015 Share Posted January 11, 2015 addEventHandler("onClientMarkerHit", marker, function(player) I used 'marker1', not 'marker'. Link to comment
Bean666 Posted January 11, 2015 Author Share Posted January 11, 2015 i changed everything to Marker1 still doesnt work. Link to comment
Bean666 Posted January 11, 2015 Author Share Posted January 11, 2015 here's my code. markerTable = { --[[marker1: ]]{-1200.4541015625, -1035.0224609375, 129.1569519043, "Cylinder", 2, 255, 200, 0, 255}, --More markers if you want. } --Create/Respawn our marker in 5 seconds setTimer(function() marker1 = createMarker(markerTable[1][1], markerTable[1][2], markerTable[1][3], markerTable[1][4], markerTable[1][5], markerTable[1][6], markerTable[1][7], markerTable[1][8], markerTable[1][9]) end, 5000, 1) GUIEditor = { button = {}, window = {}, label = {}, memo = {} } GUIEditor.window[1] = guiCreateWindow(435, 236, 394, 317, "Dead Soldier Inventory", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) GUIEditor.button[1] = guiCreateButton(124, 109, 142, 72, "M4", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(130, 260, 136, 47, "Close", false, GUIEditor.window[1]) addEventHandler("onClientMarkerHit", marker1, function(player) if (player == localPlayer) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end) addEventHandler("onClientGUIClick",GUIEditor.button[2],function() if ( source == GUIEditor.button[2]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) end end ) addEventHandler("onClientGUIClick",GUIEditor.button[1],function() if ( source == GUIEditor.button[1]) then guiSetVisible(GUIEditor.window[1],false) showCursor(false) destroyElement(marker1) triggerServerEvent ("giveweaponM4",getLocalPlayer(),giveweaponM4) end end ) Link to comment
Et-win Posted January 11, 2015 Share Posted January 11, 2015 The marker is getting created after 5 seconds the resource starts now. Now there will be an error that marker1 isn't found at the line where the addEventHandler's are. Do you even use debugscript 3? It's not a copy-past work this scripting, like you do. The example I gave is for respawning the marker. You should create the marker when the resource is started and add the setTimer function where you want to have it. (When the respawn is needed) 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