w3rt1x Posted December 19, 2022 Share Posted December 19, 2022 Hello! I need to spawn marker when I'm working and destroy it when I ain't working, how can I do that? thanks in advance! @Shady1 local marker = createMarker(-704.3701171875,963.20855712891,11, "cylinder", 1.3, 244, 244, 244, 244) local skin = getElementModel(localPlayer) function startJob(hitPlayer) local marker_1 = createMarker(-688.35162353516, 953.43170166016, 11, "cylinder", 1.3, 244, 244, 244, 244) if not getElementData(hitPlayer, 'job') then setElementData(hitPlayer,'job',true) outputChatBox('Hey! You can work.', 255, 255, 255,true) setElementModel (hitPlayer, 50) else setElementData(hitPlayer, 'job', nil) setElementModel(hitPlayer, skin) outputChatBox('Goodbye, now you cant work', 255, 255, 255,true) end end addEventHandler('onClientMarkerHit', marker, startJob) Link to comment
Shady1 Posted December 19, 2022 Share Posted December 19, 2022 1 hour ago, w3rt1x said: Hello! I need to spawn marker when I'm working and destroy it when I ain't working, how can I do that? thanks in advance! @Shady1 local marker = createMarker(-704.3701171875,963.20855712891,11, "cylinder", 1.3, 244, 244, 244, 244) local skin = getElementModel(localPlayer) function startJob(hitPlayer) local marker_1 = createMarker(-688.35162353516, 953.43170166016, 11, "cylinder", 1.3, 244, 244, 244, 244) if not getElementData(hitPlayer, 'job') then setElementData(hitPlayer,'job',true) outputChatBox('Hey! You can work.', 255, 255, 255,true) setElementModel (hitPlayer, 50) else setElementData(hitPlayer, 'job', nil) setElementModel(hitPlayer, skin) outputChatBox('Goodbye, now you cant work', 255, 255, 255,true) end end addEventHandler('onClientMarkerHit', marker, startJob) welcome to the forum, i don't understand your question much, i suggest you explain a bit more so i can help you better,but i sent you a code, i want you to test it... local marker = createMarker(-704.3701171875,963.20855712891,11, "cylinder", 1.3, 244, 244, 244, 244) local skin = getElementModel(localPlayer) local marker_1 function startJob(hitPlayer) local isJob = getElementData(hitPlayer, "job") if (isJob) then if(isElement(marker_1)) then destroyElement(marker_1) marker_1 = nil end setElementData(hitPlayer, "job", nil) setElementModel(hitPlayer, skin) outputChatBox("Goodbye, now you cant work", 255, 255, 255, true) else if(isElement(marker_1)) then destroyElement(marker_1) marker_1 = nil end marker_1 = createMarker(-688.35162353516, 953.43170166016, 11, "cylinder", 1.3, 244, 244, 244, 244) setElementData(hitPlayer, "job", true) outputChatBox("Hey! You can work.", 255, 255, 255,true) setElementModel(hitPlayer, 50) end end addEventHandler('onClientMarkerHit', marker, startJob) @w3rt1x 1 Link to comment
w3rt1x Posted December 19, 2022 Author Share Posted December 19, 2022 12 minutes ago, Shady1 said: welcome to the forum, i don't understand your question much, i suggest you explain a bit more so i can help you better,but i sent you a code, i want you to test it... local marker = createMarker(-704.3701171875,963.20855712891,11, "cylinder", 1.3, 244, 244, 244, 244) local skin = getElementModel(localPlayer) local marker_1 function startJob(hitPlayer) local isJob = getElementData(hitPlayer, "job") if (isJob) then if(isElement(marker_1)) then destroyElement(marker_1) marker_1 = nil end setElementData(hitPlayer, "job", nil) setElementModel(hitPlayer, skin) outputChatBox("Goodbye, now you cant work", 255, 255, 255, true) else if(isElement(marker_1)) then destroyElement(marker_1) marker_1 = nil end marker_1 = createMarker(-688.35162353516, 953.43170166016, 11, "cylinder", 1.3, 244, 244, 244, 244) setElementData(hitPlayer, "job", true) outputChatBox("Hey! You can work.", 255, 255, 255,true) setElementModel(hitPlayer, 50) end end addEventHandler('onClientMarkerHit', marker, startJob) @w3rt1x yea, sorry, this is what I wanted thank you so much! Link to comment
Shady1 Posted December 19, 2022 Share Posted December 19, 2022 (edited) 3 minutes ago, w3rt1x said: yea, sorry, this is what I wanted thank you so much! you're welcome, i love that your problem has been fixed, if you have any questions, create a new thread and tag me If you like my comments, you can like comment Edited December 19, 2022 by Shady1 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