Jump to content

give money problem bad arguement


battle309

Recommended Posts

bad arguements line 6 give money

 local count = 0 
  
function winGame() 
        setTimer ( winGame, 1000, 0 ) 
        if count== 300 then 
givePlayerMoney ( player, 25000 ) 
            outputChatBox("You have won!") 
        else 
            count = count + 1 
  
    end     
end 
  
addEventHandler ( "onPlayerSpawn", getRootElement(), winGame ) 

Link to comment

Well, is this serverside? since count will go +1 for everybody joining and also every time there is a timer. And then it would be FUCKED UP.

My recommendation?

function winGame() 
     setTimer(function() 
          givePlayerMoney( source, 25000) 
          outputChatBox("You have won!") 
     end, 300000, 0) 
end 
addEventHandler("onPlayerSpawn", getRootElement(), winGame ) 

Link to comment
function winGame() 
     if isTimer(timer) then destroyElement(timer) end 
     local userdata = source 
     timer = setTimer(function() 
          givePlayerMoney( userdata, 25000) 
          outputChatBox("You have won!") 
     end, 300000, 0) 
end 
addEventHandler("onPlayerSpawn", getRootElement(), winGame ) 

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