Jump to content

Problem with script!


xScatta

Recommended Posts

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

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