Jump to content

marker's


abdalbaset

Recommended Posts

Posted

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

>

Posted
  
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.

 

Posted
  
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,

>

Posted

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) 

350x20_FFFFFF_FFFFFF_000000_000000.png

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...