DRW Posted April 20, 2015 Share Posted April 20, 2015 Hello, I'm creating a script that makes a player in a specific ACL group to constantly get money every 2 seconds when on marker until the player leaves it. Now, the player in the ACL gets 500$ but just every time he hits the marker, not when he is within the marker. This is what I've got: BaseAlianza = createMarker (2794,-2418,12.6,"cylinder",5,255,0,0,255) BaseAlianzaR = createColRectangle (2784,-2442, 50,50) BaseAlianzaRC = createRadarArea (2784,-2442, 50,50,100,100,100,255) function toqueMarkerA (hitElement) if isObjectInACLGroup("user."..getAccountName( getPlayerAccount(hitElement) ), aclGetGroup("Anarquia")) then givePlayerMoney (hitElement,500) end end function toqueRectA (hitElement) if isObjectInACLGroup("user."..getAccountName( getPlayerAccount(hitElement) ), aclGetGroup("Anarquia")) then outputChatBox ("¡UN ANARQUISTA HA ENTRADO!", getRootElement()) end end addEventHandler ("onMarkerHit", BaseAlianza, toqueMarkerA) addEventHandler ("onColShapeHit", BaseAlianzaR, toqueRectA) Link to comment
WhoAmI Posted April 20, 2015 Share Posted April 20, 2015 So you want to do that if player enters the marker and he will wait there 2 seconds he will get money or what? Link to comment
ALw7sH Posted April 20, 2015 Share Posted April 20, 2015 local Time = 2 -- in seconds local Money = 500 local BaseAlianza = createMarker (2794,-2418,12.6,"cylinder",5,255,0,0,255) setTimer(function() for _,player in ipairs(getElementsByType("player")) do if isElementWithinMarker(player,BaseAlianza) then if isObjectInACLGroup("user."..getAccountName( getPlayerAccount(player) ), aclGetGroup("Anarquia")) then givePlayerMoney (player,Money) end end end end,Time*1000,0) Link to comment
DRW Posted April 20, 2015 Author Share Posted April 20, 2015 So you want to do that if player enters the marker and he will wait there 2 seconds he will get money or what? Something like that, every 2 seconds he passes into the marker he will get 500$, so when 4 seconds had passed, he would have 1000$ more, and when 6 seconds had passed, 1500$, etc. Link to comment
DRW Posted April 20, 2015 Author Share Posted April 20, 2015 local Time = 2 -- in seconds local Money = 500 local BaseAlianza = createMarker (2794,-2418,12.6,"cylinder",5,255,0,0,255) setTimer(function() for _,player in ipairs(getElementsByType("player")) do if isElementWithinMarker(player,BaseAlianza) then if isObjectInACLGroup("user."..getAccountName( getPlayerAccount(player) ), aclGetGroup("Anarquia")) then givePlayerMoney (player,Money) end end end end,Time*1000,0) Perfect, thanks! 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