abdalbaset Posted December 12, 2014 Posted December 12, 2014 hey guys how can i Check if the player inside the marker or not inside ?
abdalbaset Posted December 12, 2014 Author Posted December 12, 2014 another question how can i make the function restart witht timer example i created function that works whene you hit marker after you hit the marker ,the marker got destroyed and the function will restarted after 10sec
AJXB Posted December 12, 2014 Posted December 12, 2014 destroyElement setTimer createMarker ~ This has to be the worst board post I have ever read. It simply makes no sense. You start off by talking about space or something, then you randomly start babbling about cupcakes, and you end off with random fish names. ~ Don't listen to this guy, any board with the categories 'dinosaurs, spaceships, fried foods, wild animals, alien abductions, business casual, robots, and fireworks' has true potential.
abdalbaset Posted December 13, 2014 Author Posted December 13, 2014 marker =createMarker(-23.4414,-55.150,1002.5468,"cylinder", 1.5, 250,0,0, 255 ) setElementInterior( marker,6,-23.4414,-55.150,1003.5468) function output() outputChatBox ( "*To Rob this shop use /robshop", getRootElement(), 255, 0, 0, true ) end addEventHandler( "onMarkerHit", marker, output ) function rober(thePlayer, matchingDimension) if isElementWithinMarker(thePlayer, marker) then outputChatBox ( "robbery attempt success", getRootElement(), 0, 255, 0, true ) givePlayerMoney (thePlayer , 15000) setPlayerWantedLevel ( thePlayer, 6 ) destroyElement ( marker ) else outputChatBox("get in the marker to rob this shop", thePlayer, 255, 0, 0) end end addCommandHandler("robshop", rober) here is my code i want the player to be able to rob the shop once every 5min,
joaosilva099 Posted December 13, 2014 Posted December 13, 2014 Use something like a timer. Try this: (not tested) marker =createMarker(-23.4414,-55.150,1002.5468,"cylinder", 1.5, 250,0,0, 255 ) setElementInterior( marker,6,-23.4414,-55.150,1003.5468) function output() outputChatBox ( "*To Rob this shop use /robshop", getRootElement(), 255, 0, 0, true ) end addEventHandler( "onMarkerHit", marker, output ) cooldown = {} timeleft = {} function rober(thePlayer, matchingDimension) if (not isTimer(cooldown[thePlayer]) then if isElementWithinMarker(thePlayer, marker) then outputChatBox ( "robbery attempt success", getRootElement(), 0, 255, 0, true ) givePlayerMoney (thePlayer , 15000) setPlayerWantedLevel ( thePlayer, 6 ) cooldown[thePlayer] = setTimer(function () end, 10000, 1) destroyElement ( marker ) else outputChatBox("get in the marker to rob this shop", thePlayer, 255, 0, 0) end else left, _, _ = getTimerDetails(cooldown[thePlayer]) timeleft[thePlayer] = math.floor(left) outputChatBox("You need to wait 10s between each rob! time left: "..timeleft[thePlayer].."s", thePlayer, 255, 0, 0) end end addCommandHandler("robshop", rober) http://i.imgur.com/CSE28MJ.png Don't hesitate to contact me for anything! If I can help, I will for sure! Education is the most powerful weapon which you can use to change the world. - Castillo
abdalbaset Posted December 13, 2014 Author Posted December 13, 2014 [12:52:02] ERROR: Loading script failed: shoprob\robbery.lua:15: ')' expected ne ar 'then' that showen in the debug and i cant see the marker
Buffalo Posted December 13, 2014 Posted December 13, 2014 It means you need to put a closing bracket ) at the end of line 15 before "then" Powered by Kimsufi© ☢ ZHP on Facebook ☢ ZHP on Youtube ☢ Support us ☢
abdalbaset Posted December 13, 2014 Author Posted December 13, 2014 yep i can see the timer now but the marker not geting recreate after the timer is over
Buffalo Posted December 13, 2014 Posted December 13, 2014 So recreate it cooldown[thePlayer] = setTimer(function () marker =createMarker(-23.4414,-55.150,1002.5468,"cylinder", 1.5, 250,0,0, 255 ) setElementInterior( marker,6) end, 10000, 1) Powered by Kimsufi© ☢ ZHP on Facebook ☢ ZHP on Youtube ☢ Support us ☢
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