bosslorenz Posted July 31, 2016 Share Posted July 31, 2016 marker1 = createMarker(1201,-1340,12.2,"cylinder",2,255,0,0,255) function bankRobStart(player) local getPTeam = getTeamFromName("Criminals") local playerTeam = getPlayerTeam(player) if playerTeam == getPTeam then if getElementType(player) == "player" then outputChatBox("Stay on the marker for 5 seconds to finish bank robbing", player, 255,0,0) theTime = setTimer (function() givePlayerMoney(player, 50) end, 5000, 0) end else outputChatBox("You are not criminal", player, 255, 0, 0) end end addEventHandler("onMarkerHit",marker1,bankRobStart) function killTime() if isTimer(theTime) then killTimer(theTime) end end addEventHandler("onMarkerLeave", marker1, killTime) addEventHandler("onPlayerQuit", getRootElement(), killTime) addEventHandler("onPlayerWasted", getRootElement(), killTime) Example marker1. Available for 10minutes. After that it gets destroy. Again, after 20 minutes from destruction. It spawns again for 10minutes. Need some help here. Link to comment
Wumbaloo Posted July 31, 2016 Share Posted July 31, 2016 Just put some timer using "destroyElement" and "createMarker" function. Link to comment
bosslorenz Posted July 31, 2016 Author Share Posted July 31, 2016 setTimer(function() marker1 = createMarker(1201,-1340,12.2,"cylinder",2,255,0,0,255) end,30000,0) Here I made this but the other function addEventHandler("onMarkerHit",marker1,bankRobStart) Error expected element on argument 2, got nil. Since I made the marker inside the setTimer function. the marker1 on argument 2 cant be called. Link to comment
Wumbaloo Posted July 31, 2016 Share Posted July 31, 2016 Put the event handler in the setTimer function of marker1 Link to comment
bosslorenz Posted July 31, 2016 Author Share Posted July 31, 2016 Maybe I will just change the idea since it is too complicated . The one I have to put setTimer and destroys is the marker entrance. The rob marker will just stay then. Link to comment
Wumbaloo Posted July 31, 2016 Share Posted July 31, 2016 I'm not on my computer so I can't send you a example It's not complicated Link to comment
bosslorenz Posted July 31, 2016 Author Share Posted July 31, 2016 function startBR() brEnt = createMarker(1570.2,-1337.7,17,"arrow",1,0,255,0,255) outputChatBox("Bank is now open, you can rob it for 1 minute") setTimer(destroyElement,60000,1,brEnt) end addCommandHandler("br",startBR) So I have made this marker (entrance to bank rob), and disappears after 1 minute. 1) But what eventHandler should I use for it to start the function as soon as the server starts? Link to comment
Wumbaloo Posted July 31, 2016 Share Posted July 31, 2016 Server side : "onResourceStart" Link to comment
bosslorenz Posted July 31, 2016 Author Share Posted July 31, 2016 Now I can test my scripts. Just worked on VMWare and now I am using 2 mtasa on 1 computer 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