Mann56 Posted March 27, 2015 Share Posted March 27, 2015 Hey guys, in my resource when i load it the gui's just come up empty and also when i click on spawn a vehicle then it says that event is triggered clientside but not added serverside Here's my code -> Server createTeam ("Pizza",255,255,0) --gui window 1 ------------------------------------------------------------------------------------------------------------- --client event 1 addEvent("acceptTheJob", true) function getTheSkin(thePlayer) end addEventHandler("acceptTheJob", root, function(var) if var == "Enter" then local team = getPlayerTeam(client) if team and getTeamName(team) == "Pizza" then outputChatBox("PIZZA JOB : You are already employed.", client, 255, 255, 0) else setPlayerTeam(client, getTeamFromName("Pizza")) outputChatBox("PIZZA JOB : You are now employed as a Pizzaboy!", client, 255, 255, 0) setElementModel(client,155) triggerClientEvent("onClientRender",playerSource) end elseif var == "Leave" then setPlayerTeam(client, nil) outputChatBox("PIZZA JOB : You left your job and are unemployed now!", client, 255, 255, 0) setElementModel(client,0) end end) --gui 2 (secondary gui) ----------------------- addEvent("getPizza",true) addEventHandler("getPizza",root, function() outputChatBox("PIZZA JOB : You took 1 Pizza",client,255,255,0) end ) addEvent("getPizza2",true) addEventHandler("getPizza2",root, function () outputChatBox("PIZZA JOB : You took 2 Pizza's",client,255,255,0) end) addEvent("getPizza3",true) addEventHandler("getPizza3",root, function() outputChatBox("PIZZA JOB : You took 3 Pizza's",client,255,255,0) end) addEvent("getPizza4",true) addEventHandler("getPizza4",root, function() outputChatBox("PIZZA JOB : You took 4 Pizza's",client,255,255,0) end) addEvent("getPizza5",true) addEventHandler("getPizza5",root, function() outputChatBox("PIZZA JOB : You took 5 Pizza's",client,255,255,0) end) addEvent("getPizza6",true) addEventHandler("getPizza6",root, function() outputChatBox("PIZZA JOB : You took 6 Pizza's",client,255,255,0) end) ------------------------------------------------------------------------------------------------------------------------------- addEvent("veh",true) addEventHandler("veh",root, function () local p = getLocalPlayer() local x,y,z = getElementPosition (p) vehicle = createVehicle (448 , x+5, y+5, z)) -- gate ------------------------------------------------------------------------------------------------------------------------ gate = createObject(985,-1698.5302734375, 1392.7216796875, 7.1786022186279, 0,0,130.67932128906 ) colRect = createColCircle(-1697.7197265625, 1391.74609375, 6) addEventHandler("onColShapeHit",colRect, function(thePlayer,matchingDimension) if getElementType(thePlayer) == "player" or getElementType(thePlayer) == "vehicle" then local d = getTeamName(getPlayerTeam(thePlayer)) if d == "Pizza" then movegate = moveObject(gate , 3000 ,-1704.947265625, 1398.6650390625, 7.1784038543701) end else outputChatBox("You are not a pizzaboy!",getRootElement(),255,255,0) end end ) addEventHandler("onColShapeLeave",colRect, function(thePlayer,matchingDimension) if getElementType(thePlayer) == "player" or getElementType(thePlayer) == "vehicle" then setGateBack = moveObject (gate , 3000,-1698.5302734375, 1392.7216796875, 7.1786022186279 ) end end) createObject(985,-1659.521484375, 1432.36328125, 7.1759605407715, 0,0,130.67932128906) -- pizzahelp addCommandHandler("pizzahelp", function() outputChatBox("Pizza : In the pizza you as a pizzaboy have to deliver pizzas to locations and you get money by delivering the package.") end) Client -- main GUI GUIEditor = { button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(308, 173, 399, 425, "Pizza ", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) --I setted as invisible GUIEditor.label[1] = guiCreateLabel(14, 31, 365, 63, " Well Stacked Pizza Co.", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "sa-header") guiLabelSetColor(GUIEditor.label[1], 255, 255, 2) GUIEditor.label[2] = guiCreateLabel(44, 111, 320, 124, " Welcome to the Well Stacked Pizza Co.\n You can employ now as a pizzaboy!\n As a pizzaboy you have to deliver pizza's\n throughout the town.\n You will get money for that.\n\n For help type /pizzahelp", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "clear-normal") GUIEditor.button[1] = guiCreateButton(96, 247, 215, 42, "Accept ", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "C8FFFF00") GUIEditor.button[2] = guiCreateButton(118, 307, 164, 36, "Leave ", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "C8FD0802") GUIEditor.button[3] = guiCreateButton(122, 368, 150, 32, "Close", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "sa-header") end ) addEventHandler("onClientGUIClick", root, function() if source == GUIEditor.button[1] then closeWind() triggerServerEvent("acceptTheJob", localPlayer, "Enter") elseif source == GUIEditor.button[2] then closeWind() triggerServerEvent("acceptTheJob", localPlayer, "Leave") elseif source == GUIEditor.button[3] then closeWind() end end) function closeWind() guiSetVisible(GUIEditor.window[1], false) showCursor(false) end pizzaMarker = createMarker(-1721.0263671875, 1355.9541015625, 6.1805019378662, "cylinder", 1.25, 255, 255, 0, 180) addEventHandler("onClientMarkerHit", pizzaMarker, function(player) if player == localPlayer and not isPedInVehicle(player) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end) --second gui GUIEditor = { button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() win2 = guiCreateWindow(314, 135, 393, 492, "Pizza GUI", false) guiWindowSetSizable(win2, false) GUIEditor.label[1] = guiCreateLabel(26, 40, 332, 96, "How many Pizza's you\nwant to deliver?", false, win2) guiSetFont(GUIEditor.label[1], "sa-header") guiLabelSetColor(GUIEditor.label[1], 236, 151, 18) button1 = guiCreateButton(35, 143, 142, 57, "1", false, win2) guiSetFont(button1, "sa-header") guiSetProperty(button1, "NormalTextColour", "FFAAAAAA") button2 = guiCreateButton(35, 219, 142, 58, "3", false, win2) guiSetFont(button2, "sa-header") guiSetProperty(button2, "NormalTextColour", "FFAAAAAA") button3 = guiCreateButton(205, 217, 147, 60, "4", false, win2) guiSetFont(button3 , "sa-header") guiSetProperty(button3, "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(204, 145, 148, 56, "2", false, win2) guiSetFont(GUIEditor.button[4], "sa-header") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA") GUIEditor.button[5] = guiCreateButton(37, 295, 140, 58, "5", false, win2) guiSetFont(GUIEditor.button[5], "sa-header") guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFAAAAAA") GUIEditor.button[6] = guiCreateButton(205, 294, 147, 59, "6", false, win2) guiSetFont(GUIEditor.button[6], "sa-header") guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFAAAAAA") GUIEditor.button[7] = guiCreateButton(42, 392, 300, 39, "Close", false, win2) guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA") guiSetVisible(win2,false) end ) pizzacount = 0 addEventHandler("onClientGUIClick",root, function () if source == button1 then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza" ,localPlayer,"1 Pizza") pizzacount = pizzacount+1 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[4] then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza2",localPlayer,"2 Pizza") pizzacount = pizzacount+2 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == button2 then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza3",localPlayer,"3 Pizza") pizzacount = pizzacount+3 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == button3 then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza4",localPlayer,"4 Pizza") pizzacount = pizzacount+4 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[5] then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza5",localPlayer,"5 Pizza") pizzacount = pizzacount+5 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[6] then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza6",localPlayer,"6 Pizza") pizzacount = pizzacount+6 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[7] then closeWindow() end end ) function closeWindow() guiSetVisible(win2,false) showCursor(false) end ----------- vehicle gui---------------------------------------------------------------------------------------------- GUIEditor = { button = {} } addEventHandler("onClientResourceStart", resourceRoot, function() vehwin = guiCreateWindow(390, 196, 312, 261, "Vehicle Window", false) guiWindowSetSizable(vehwin, false) vehbut1 = guiCreateButton(28, 51, 251, 69, "Spawn Pizzaboy", false, vehwin) guiSetFont(vehbut1, "sa-header") guiSetProperty(vehbut1, "NormalTextColour", "FFFBFE00") vehbut2 = guiCreateButton(30, 162, 249, 66, "Close", false, vehwin) guiSetFont(vehbut2, "sa-header") guiSetProperty(vehbut2, "NormalTextColour", "FFAAAAAA") guiSetVisible(vehwin,false) end ) marker2 = createMarker(-1678.615234375, 1409.3828125, 6.1794281005859, "cylinder",1.25, 255, 255, 0, 180) addEventHandler("onClientMarkerHit", marker2, function(player) if player == localPlayer and not isPedInVehicle(player) then guiSetVisible(vehwin, true) showCursor(true) end end) function closeWine() guiSetVisible(vehwin,false) showCursor(false) end addEventHandler("onClientGUIClick",root, function () if source == vehbut1 then triggerServerEvent("veh",localPlayer) closeWine() elseif source == vehbut2 then closeWine() end end) --------------------------------------------------------------------------------------------------------- marker4 = createMarker(8184.484375, -1822.6887207031, 51.855865478516, "cylinder",1.25,255,255,0) addEventHandler("onClientMarkerHit", marker4, function(player) if player == localPlayer and not isPedInVehicle(player) then guiSetVisible(win2, true) showCursor(true) end end) -- ------------------------------------------------------------------------------------------------------------- marker3 = createMarker(-1685.2763671875, 1401.8896484375, 8.1815948486328, "arrow", 1.25,255,255,0 ) function teleportPlayer(source) setElementPosition(source,8185,-1814,53,true) end addEventHandler("onClientMarkerHit", marker3,teleportPlayer) --------------------------------------------------------------------------------------------------------------------- marker5 = createMarker(8186.6630859375, -1817.7219238281, 53.855865478516, "arrow",1.25,255,255,0) function teleportPlayer1(source) setElementPosition(source,-1687.0810546875, 1403.787109375, 7.1788845062256,true) end addEventHandler("onClientMarkerHit", marker5,teleportPlayer1) ----------------------------------------------------------------------------------------------------------------- pizzaguy = createPed(155, -1720.0400390625, 1356.6455078125, 7.1875, 121.70565795898) setElementFrozen(pizzaguy, true) addEventHandler("onClientPedDamage", pizzaguy, cancelEvent) pgboy = createPed(155, -1677.861328125, 1410.26953125, 7.1853160858154, 141.66812133789) setElementFrozen(pgboy, true) addEventHandler("onCLientPedDamage", pgboy, cancelEvent) createBlip(-1723.74, 1359.68, 6.18, 29, 2, 0, 0, 0, 255, 0, 200) Link to comment
ahmedo01 Posted March 27, 2015 Share Posted March 27, 2015 Ehm, i am not sure but It can gave error for one space. addEvent("veh",true) addEventHandler("veh",root, function () local p = getLocalPlayer() local x,y,z = getElementPosition (p) vehicle = createVehicle (448 , x+5, y+5, z)) Change it to this addEvent("veh",true) addEventHandler("veh",root, function() local p = getLocalPlayer() local x,y,z = getElementPosition (p) vehicle = createVehicle (448 , x+5, y+5, z)) Link to comment
Mr-M3AND Posted March 28, 2015 Share Posted March 28, 2015 -- Client -- GUIEditor = { button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(308, 173, 399, 425, "Pizza ", false) guiWindowSetMovable(GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) --I setted as invisible GUIEditor.label[1] = guiCreateLabel(14, 31, 365, 63, " Well Stacked Pizza Co.", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "sa-header") guiLabelSetColor(GUIEditor.label[1], 255, 255, 2) GUIEditor.label[2] = guiCreateLabel(44, 111, 320, 124, " Welcome to the Well Stacked Pizza Co.\n You can employ now as a pizzaboy!\n As a pizzaboy you have to deliver pizza's\n throughout the town.\n You will get money for that.\n\n For help type /pizzahelp", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "clear-normal") GUIEditor.button[1] = guiCreateButton(96, 247, 215, 42, "Accept ", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[1], "sa-header") guiSetProperty(GUIEditor.button[1], "NormalTextColour", "C8FFFF00") GUIEditor.button[2] = guiCreateButton(118, 307, 164, 36, "Leave ", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[2], "sa-header") guiSetProperty(GUIEditor.button[2], "NormalTextColour", "C8FD0802") GUIEditor.button[3] = guiCreateButton(122, 368, 150, 32, "Close", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[3], "sa-header") end ) addEventHandler("onClientGUIClick", root, function() if source == GUIEditor.button[1] then closeWind() triggerServerEvent("acceptTheJob", localPlayer, "Enter") elseif source == GUIEditor.button[2] then closeWind() triggerServerEvent("acceptTheJob", localPlayer, "Leave") elseif source == GUIEditor.button[3] then closeWind() end end) function closeWind() guiSetVisible(GUIEditor.window[1], false) showCursor(false) end pizzaMarker = createMarker(-1721.0263671875, 1355.9541015625, 6.1805019378662, "cylinder", 1.25, 255, 255, 0, 180) addEventHandler("onClientMarkerHit", pizzaMarker, function(player) if player == localPlayer and not isPedInVehicle(player) then guiSetVisible(GUIEditor.window[1], true) showCursor(true) end end) --second gui GUIEditor = { button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() win2 = guiCreateWindow(314, 135, 393, 492, "Pizza GUI", false) guiWindowSetSizable(win2, false) GUIEditor.label[1] = guiCreateLabel(26, 40, 332, 96, "How many Pizza's you\nwant to deliver?", false, win2) guiSetFont(GUIEditor.label[1], "sa-header") guiLabelSetColor(GUIEditor.label[1], 236, 151, 18) button1 = guiCreateButton(35, 143, 142, 57, "1", false, win2) guiSetFont(button1, "sa-header") guiSetProperty(button1, "NormalTextColour", "FFAAAAAA") button2 = guiCreateButton(35, 219, 142, 58, "3", false, win2) guiSetFont(button2, "sa-header") guiSetProperty(button2, "NormalTextColour", "FFAAAAAA") button3 = guiCreateButton(205, 217, 147, 60, "4", false, win2) guiSetFont(button3 , "sa-header") guiSetProperty(button3, "NormalTextColour", "FFAAAAAA") GUIEditor.button[4] = guiCreateButton(204, 145, 148, 56, "2", false, win2) guiSetFont(GUIEditor.button[4], "sa-header") guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FFAAAAAA") GUIEditor.button[5] = guiCreateButton(37, 295, 140, 58, "5", false, win2) guiSetFont(GUIEditor.button[5], "sa-header") guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFAAAAAA") GUIEditor.button[6] = guiCreateButton(205, 294, 147, 59, "6", false, win2) guiSetFont(GUIEditor.button[6], "sa-header") guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFAAAAAA") GUIEditor.button[7] = guiCreateButton(42, 392, 300, 39, "Close", false, win2) guiSetProperty(GUIEditor.button[7], "NormalTextColour", "FFAAAAAA") guiSetVisible(win2,false) end ) pizzacount = 0 addEventHandler("onClientGUIClick",root, function () if source == button1 then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza" ,localPlayer,"1 Pizza") pizzacount = pizzacount+1 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[4] then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza2",localPlayer,"2 Pizza") pizzacount = pizzacount+2 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == button2 then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza3",localPlayer,"3 Pizza") pizzacount = pizzacount+3 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == button3 then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza4",localPlayer,"4 Pizza") pizzacount = pizzacount+4 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[5] then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza5",localPlayer,"5 Pizza") pizzacount = pizzacount+5 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[6] then if pizzacount < 6 then closeWindow() triggerServerEvent("getPizza6",localPlayer,"6 Pizza") pizzacount = pizzacount+6 else outputChatBox("PIZZA JOB : Number of Pizza's exceed the limit!",255,255,0) end elseif source == GUIEditor.button[7] then closeWindow() end end ) function closeWindow() guiSetVisible(win2,false) showCursor(false) end ----------- vehicle gui---------------------------------------------------------------------------------------------- addEventHandler("onClientResourceStart", resourceRoot, function() vehwin = guiCreateWindow(390, 196, 312, 261, "Vehicle Window", false) guiWindowSetSizable(vehwin, false) vehbut1 = guiCreateButton(28, 51, 251, 69, "Spawn Pizzaboy", false, vehwin) guiSetFont(vehbut1, "sa-header") guiSetProperty(vehbut1, "NormalTextColour", "FFFBFE00") vehbut2 = guiCreateButton(30, 162, 249, 66, "Close", false, vehwin) guiSetFont(vehbut2, "sa-header") guiSetProperty(vehbut2, "NormalTextColour", "FFAAAAAA") guiSetVisible(vehwin,false) end ) marker2 = createMarker(-1678.615234375, 1409.3828125, 6.1794281005859, "cylinder",1.25, 255, 255, 0, 180) addEventHandler("onClientMarkerHit", marker2, function(player) if player == localPlayer and not isPedInVehicle(player) then guiSetVisible(vehwin, true) showCursor(true) end end) function closeWine() guiSetVisible(vehwin,false) showCursor(false) end addEventHandler("onClientGUIClick",root, function () if source == vehbut1 then triggerServerEvent("veh",localPlayer) closeWine() elseif source == vehbut2 then closeWine() end end) --------------------------------------------------------------------------------------------------------- marker4 = createMarker(8184.484375, -1822.6887207031, 51.855865478516, "cylinder",1.25,255,255,0) addEventHandler("onClientMarkerHit", marker4, function(player) if player == localPlayer and not isPedInVehicle(player) then guiSetVisible(win2, true) showCursor(true) end end) -- ------------------------------------------------------------------------------------------------------------- marker3 = createMarker(-1685.2763671875, 1401.8896484375, 8.1815948486328, "arrow", 1.25,255,255,0 ) function teleportPlayer(source) setElementPosition(source,8185,-1814,53,true) end addEventHandler("onClientMarkerHit", marker3,teleportPlayer) --------------------------------------------------------------------------------------------------------------------- marker5 = createMarker(8186.6630859375, -1817.7219238281, 53.855865478516, "arrow",1.25,255,255,0) function teleportPlayer1(source) setElementPosition(source,-1687.0810546875, 1403.787109375, 7.1788845062256,true) end addEventHandler("onClientMarkerHit", marker5,teleportPlayer1) ----------------------------------------------------------------------------------------------------------------- pizzaguy = createPed(155, -1720.0400390625, 1356.6455078125, 7.1875, 121.70565795898) setElementFrozen(pizzaguy, true) addEventHandler("onClientPedDamage", pizzaguy, cancelEvent) pgboy = createPed(155, -1677.861328125, 1410.26953125, 7.1853160858154, 141.66812133789) setElementFrozen(pgboy, true) addEventHandler("onCLientPedDamage", pgboy, cancelEvent) createBlip(-1723.74, 1359.68, 6.18, 29, 2, 0, 0, 0, 255, 0, 200) Link to comment
Mann56 Posted March 28, 2015 Author Share Posted March 28, 2015 Thank you very much it's working. Can you tell me where was the error? Link to comment
Mr-M3AND Posted March 28, 2015 Share Posted March 28, 2015 Thank you very much it's working. Can you tell me where was the error? Client side #165 GUIEditor = { button = {} } remove it ^ Server side #66 addEvent("veh",true) addEventHandler("veh",root, function () local p = getLocalPlayer() local x,y,z = getElementPosition (p) vehicle = createVehicle (448 , x+5, y+5, z) ) to addEvent("veh",true) addEventHandler("veh",root, function () local p = getLocalPlayer() local x,y,z = getElementPosition (p) vehicle = createVehicle (448 , x+5, y+5, z) end ) 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