xScatta Posted September 25, 2013 Share Posted September 25, 2013 Hey code here problem below: markerx = createMarker(361.82,173.61,1008.38,"cylinder") setElementInterior(markerx,3) state = 0; function payday(playerSource) if state==0 then if isElementWithinMarker(playerSource,markerx) then outputChatBox("Zaczeles rabunek poczekaj 2 min.",playerSource,255,255,255,true) setTimer ( function () givePlayerMoney(playerSource,25000) outputChatBox("Obrabowales bank a teraz uciekaj jezeli ktos cie zabije w przeciagu 5min to stracisz kase!",playerSource,0,0,0,true)addEventHandler("onPlayerWasted",playerSource,paydayx) end, 120000, 1 ) state = state + 1 paydayt() else outputChatBox("Musisz byc w markerze.",playerSource) end else outputChatBox("Juz ktos obrabowoje bank.",playerSource) end end function paydayx(ammo,killer) if state==1 then takePlayerMoney(source,25000) givePlayerMoney(killer,25000) outputChatBox("Zostales zabity przez: "..getPlayerName(killer).." straciles kase ktora obrabowales.",source,0,0,0,true) outputChatBox("Zabiles: "..getPlayerName(source).." ktory obrabowal bank przed chwila i zarobiles 25,000",killer,0,0,0,true) state = state - 1 removeEventHandler("onPlayerWasted",playerSource,payday) end end function paydayt() setTimer ( function () removeEventHandler("onPlayerWasted",playerSource,payday) end,300000,1) state = state - 1 end addCommandHandler("heist",payday) Problem exist's in here because when i type /heist and wait the 2Mins like in settimer then i get money but when someone kill me before state was changed to 0 then nothing happen's. i don't lose my money and player dont get his money. Link to comment
Moderators IIYAMA Posted September 25, 2013 Moderators Share Posted September 25, 2013 Take a close look to this page and don't define playerSource as the (dead)player his last ammo -_-" LUA:5 https://wiki.multitheftauto.com/wiki/OnPlayerWasted The killer can also be nil. LUA:17 if killer then You can take more of my time if you solve at least those problems. 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