MaLiYaViBz Posted June 7, 2023 Share Posted June 7, 2023 i created tree cuting job in my server but it have probem. when i take job ,job panel going to all players in server . how can fix it jobPed = createPed(230, 870.47406, -24.95437, 63.97986, 160) setPedFrozen(jobPed, true) jobMarker = createMarker(870.02686, -25.90853, 62.90933, "cylinder", 1.5) createBlipAttachedTo(jobMarker, 22) addEventHandler("onClientMarkerHit", jobMarker, function(player) window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*", false) memo = guiCreateMemo(100, 20, 240, 100, "Unicos RP Tree Job You can make esy money with rhis one# happy happy happy", false, window) button = guiCreateButton(20, 150, 100, 100, "Accep", false, window) closebutton = guiCreateButton(150, 150, 100, 100, "Close", false, window) showCursor(true) end) function clicks() if source == closebutton then guiSetVisible(window, false) showCursor(false) elseif source == button then guiSetVisible(window, false) showCursor(false) --outputChatBox("You Have a Job!", 0, 255, 0) triggerServerEvent("StartTreeJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clicks) Link to comment
βurak Posted June 7, 2023 Share Posted June 7, 2023 (edited) Change resourceRoot to localPlayer triggerServerEvent("StartTreeJob", localPlayer, localPlayer) Edited June 7, 2023 by Burak5312 Link to comment
MaLiYaViBz Posted June 7, 2023 Author Share Posted June 7, 2023 why onclientHitmarker does not working jobPed = createPed(230, 870.47406, -24.95437, 63.97986, 160) setPedFrozen(jobPed, true) jobMarker = createMarker(870.02686, -25.90853, 62.90933, "cylinder", 1.5) createBlipAttachedTo(jobMarker, 22) function job(theplayer , matchingDimension) if theplayer and theplayer == localplayer and matchingDimension then window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*" ,false) memo = guiCreateMemo(100, 20, 240, 100, "Unicos RP Tree Job You can make esy money with rhis one# happy happy happy" ,false, window) button = guiCreateButton(20, 150, 100, 100, "Accep" ,false, window) closebutton = guiCreateButton(150, 150, 100, 100, "Close" ,false, window) showCursor(true) end end addEventHandler("onClientMarkerHit", jobMarker, job) function clicks() if source == closebutton then guiSetVisible(window, false) showCursor(false) elseif source == button then guiSetVisible(window, false) showCursor(false) triggerServerEvent("StartTreeJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clicks) Link to comment
FlorinSzasz Posted June 7, 2023 Share Posted June 7, 2023 also replace the your last line with this addEventHandler ( "onClientGUIClick", closebutton, clicks, false ) addEventHandler ( "onClientGUIClick", button, clicks, false ) 1 Link to comment
βurak Posted June 7, 2023 Share Posted June 7, 2023 On 07/06/2023 at 12:04, MaLiYaViBz said: its not working Expand can you show the server side? 1 Link to comment
MaLiYaViBz Posted June 7, 2023 Author Share Posted June 7, 2023 On 07/06/2023 at 13:22, Burak5312 said: can you show the server side? Expand addEvent("StartTreeJob", true) addEventHandler("StartTreeJob", root, function(player) Cut = createMarker(866.58081, -37.67114, 62.91922, "cylinder", 1.0, 0, 255, 255) addEventHandler("onMarkerHit", Cut, function () setPedFrozen(player, true) setTimer(function() setPedAnimation(player, "SWORD", "sword_4", 1, true) end, 200, 20) setTimer(function() setPedFrozen(player, false) givePlayerMoney(player, math.random(1000, 5000)) end, 4000, 1) end) end) On 07/06/2023 at 14:12, MaLiYaViBz said: addEvent("StartTreeJob", true) addEventHandler("StartTreeJob", root, function(player) Cut = createMarker(866.58081, -37.67114, 62.91922, "cylinder", 1.0, 0, 255, 255) addEventHandler("onMarkerHit", Cut, function () setPedFrozen(player, true) setTimer(function() setPedAnimation(player, "SWORD", "sword_4", 1, true) end, 200, 20) setTimer(function() setPedFrozen(player, false) givePlayerMoney(player, math.random(1000, 5000)) end, 4000, 1) end) end) Expand Link to comment
MaLiYaViBz Posted June 7, 2023 Author Share Posted June 7, 2023 On 07/06/2023 at 12:49, FlorinSzasz said: also replace the your last line with this addEventHandler ( "onClientGUIClick", closebutton, clicks, false ) addEventHandler ( "onClientGUIClick", button, clicks, false ) Expand oh no its my mistake. when hit player on marker. job panel goin all players Link to comment
Shady1 Posted June 7, 2023 Share Posted June 7, 2023 On 07/06/2023 at 12:45, MaLiYaViBz said: why onclientHitmarker does not working jobPed = createPed(230, 870.47406, -24.95437, 63.97986, 160) setPedFrozen(jobPed, true) jobMarker = createMarker(870.02686, -25.90853, 62.90933, "cylinder", 1.5) createBlipAttachedTo(jobMarker, 22) function job(theplayer , matchingDimension) if theplayer and theplayer == localplayer and matchingDimension then window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*" ,false) memo = guiCreateMemo(100, 20, 240, 100, "Unicos RP Tree Job You can make esy money with rhis one# happy happy happy" ,false, window) button = guiCreateButton(20, 150, 100, 100, "Accep" ,false, window) closebutton = guiCreateButton(150, 150, 100, 100, "Close" ,false, window) showCursor(true) end end addEventHandler("onClientMarkerHit", jobMarker, job) function clicks() if source == closebutton then guiSetVisible(window, false) showCursor(false) elseif source == button then guiSetVisible(window, false) showCursor(false) triggerServerEvent("StartTreeJob", resourceRoot, localPlayer) end end addEventHandler("onClientGUIClick", root, clicks) Expand jobPed = createPed(230, 870.47406, -24.95437, 63.97986, 160) setPedFrozen(jobPed, true) jobMarker = createMarker(870.02686, -25.90853, 62.90933, "cylinder", 1.5) createBlipAttachedTo(jobMarker, 22) function job(thePlayer, matchingDimension) if thePlayer and thePlayer == localPlayer and matchingDimension then window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*", false) memo = guiCreateMemo(20, 20, 210, 140, "Unicos RP Tree Job. You can make easy money with this one. Happy happy happy.", false, window) button = guiCreateButton(30, 180, 80, 40, "Accept", false, window) closebutton = guiCreateButton(140, 180, 80, 40, "Close", false, window) showCursor(true) end end addEventHandler("onClientMarkerHit", jobMarker, job) function clicks(button, state) if button == "left" and state == "up" then if source == closebutton then guiSetVisible(window, false) showCursor(false) elseif source == button then guiSetVisible(window, false) showCursor(false) triggerServerEvent("StartTreeJob", resourceRoot, localPlayer) end end end addEventHandler("onClientGUIClick", root, clicks) I hope this helps! 1 Link to comment
MaLiYaViBz Posted June 7, 2023 Author Share Posted June 7, 2023 On 07/06/2023 at 15:28, Shady1 said: jobPed = createPed(230, 870.47406, -24.95437, 63.97986, 160) setPedFrozen(jobPed, true) jobMarker = createMarker(870.02686, -25.90853, 62.90933, "cylinder", 1.5) createBlipAttachedTo(jobMarker, 22) function job(thePlayer, matchingDimension) if thePlayer and thePlayer == localPlayer and matchingDimension then window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*", false) memo = guiCreateMemo(20, 20, 210, 140, "Unicos RP Tree Job. You can make easy money with this one. Happy happy happy.", false, window) button = guiCreateButton(30, 180, 80, 40, "Accept", false, window) closebutton = guiCreateButton(140, 180, 80, 40, "Close", false, window) showCursor(true) end end addEventHandler("onClientMarkerHit", jobMarker, job) function clicks(button, state) if button == "left" and state == "up" then if source == closebutton then guiSetVisible(window, false) showCursor(false) elseif source == button then guiSetVisible(window, false) showCursor(false) triggerServerEvent("StartTreeJob", resourceRoot, localPlayer) end end end addEventHandler("onClientGUIClick", root, clicks) I hope this helps! Expand accept button is not working corectly Link to comment
Shady1 Posted June 7, 2023 Share Posted June 7, 2023 On 07/06/2023 at 16:08, MaLiYaViBz said: accept button is not working corectly Expand function clicks(button, state, _, _) if button == "left" and state == "up" then if source == closebutton then guiSetVisible(window, false) showCursor(false) elseif source == button then guiSetVisible(window, false) showCursor(false) triggerServerEvent("StartTreeJob", resourceRoot, localPlayer) end end end Link to comment
FlorinSzasz Posted June 7, 2023 Share Posted June 7, 2023 On 07/06/2023 at 14:55, MaLiYaViBz said: oh no its my mistake. when hit player on marker. job panel goin all players Expand yes because you call it for every player not the one who hits the marker addEventHandler("onClientMarkerHit", jobMarker, function(player) if player == localPlayer then window = guiCreateWindow(500, 200, 250, 250, "*Tree JoB*", false) memo = guiCreateMemo(100, 20, 240, 100, "Unicos RP Tree Job You can make esy money with rhis one# happy happy happy", false, window) button = guiCreateButton(20, 150, 100, 100, "Accep", false, window) closebutton = guiCreateButton(150, 150, 100, 100, "Close", false, window) showCursor(true) end end) 1 Link to comment
MaLiYaViBz Posted June 7, 2023 Author Share Posted June 7, 2023 can you explain how you change Link to comment
FlorinSzasz Posted June 7, 2023 Share Posted June 7, 2023 On 07/06/2023 at 16:28, MaLiYaViBz said: can you explain how you change Expand add before job function this -> local button local closebutton 1 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