Jump to content

help setTimer


Recommended Posts

-- Server Side -- 
function payDay () 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday" getRootElement(), 255, 0, 0, true )  
addEventHandler ( "onResourceStart", getRootElement(), payDay ) - evento 
  
function payDay2 () 
setTimer (payDay2) 
outputChatBox ( "#DDA0DD--PAYDAY--" getRootElement(), 255,0,0, true ) 
outputChatBox ( "#708090Pagamento: 2000$" getRootElement(), 255,0,0, true ) 
outputChatBox ( "#708090Imposto Cobrado: 200$" getRootElement(), 255,0,0, true ) 
givePlayerMoney ( 2000 ) 
takePlayerMoney ( 200 ) 
end, 600000, 1)  
end 

SetTimer is correct?

Link to comment

you want takePlayerMoney and givePlayerMoney for all players ?

+ The chat on start the resource you want this for all?

+ where is the argument for the give and take player money ?

+ where is The ',' for chat Box?

+ the timer is wrong should be 'setTimer(function()'

Link to comment
you want takePlayerMoney and givePlayerMoney for all players ?

+ The chat on start the resource you want this for all?

+ where is the argument for the give and take player money ?

+ where is The ',' for chat Box?

+ the timer is wrong should be 'setTimer(function()'

yes, well?

function payDay2 () 
setTimer (payDay2)() 
outputChatBox ( "#DDA0DD--PAYDAY--" getRootElement(), 255,0,0, true ) 
outputChatBox ( "#708090Pagamento: 2000$" getRootElement(), 255,0,0, true ) 
outputChatBox ( "#708090Imposto Cobrado: 200$" getRootElement(), 255,0,0, true ) 
givePlayerMoney ( 2000 ) 
takePlayerMoney ( 200 ) 
end, 600000, 1)  
end 

Link to comment

-- Server Side #

function payDay () 
    for _,v in ipairs(getElementsByType("player")) do 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday",v, 255, 0, 0, true ) 
    end 
end 
addEventHandler ( "onResourceStart",resourceRoot, payDay ) 
  
setTimer(function() 
    for I,v in ipairs(getElementsByType('player')) do 
    outputChatBox ( "#DDA0DD--PAYDAY--",v, 255,0,0, true ) 
    outputChatBox ( "#708090Pagamento: 2000$",v, 255,0,0, true ) 
    outputChatBox ( "#708090Imposto Cobrado: 200$",v, 255,0,0, true ) 
    givePlayerMoney (v,2000 ) 
    takePlayerMoney (v,200 ) 
    end 
end, 6000000, 1) 

Note : Money will become a "negative '-' " if 200 was withdrawn and the player does not own.

To know whether the player has the money or do not use : getPlayerMoney.

Link to comment
-- Server Side #

function payDay () 
    for _,v in ipairs(getElementsByType("player")) do 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday",v, 255, 0, 0, true ) 
    end 
end 
addEventHandler ( "onResourceStart",resourceRoot, payDay ) 
  
setTimer(function() 
    for I,v in ipairs(getElementsByType('player')) do 
    outputChatBox ( "#DDA0DD--PAYDAY--",v, 255,0,0, true ) 
    outputChatBox ( "#708090Pagamento: 2000$",v, 255,0,0, true ) 
    outputChatBox ( "#708090Imposto Cobrado: 200$",v, 255,0,0, true ) 
    givePlayerMoney (v,2000 ) 
    takePlayerMoney (v,200 ) 
    end 
end, 6000000, 1) 

Note : Money will become a "negative '-' " if 200 was withdrawn and the player does not own.

To know whether the player has the money or do not use : getPlayerMoney.

You can use 'root' instead of loop all players.

Link to comment
-- Server Side #

function payDay () 
    for _,v in ipairs(getElementsByType("player")) do 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday",v, 255, 0, 0, true ) 
    end 
end 
addEventHandler ( "onResourceStart",resourceRoot, payDay ) 
  
setTimer(function() 
    for I,v in ipairs(getElementsByType('player')) do 
    outputChatBox ( "#DDA0DD--PAYDAY--",v, 255,0,0, true ) 
    outputChatBox ( "#708090Pagamento: 2000$",v, 255,0,0, true ) 
    outputChatBox ( "#708090Imposto Cobrado: 200$",v, 255,0,0, true ) 
    givePlayerMoney (v,2000 ) 
    takePlayerMoney (v,200 ) 
    end 
end, 6000000, 1) 

Note : Money will become a "negative '-' " if 200 was withdrawn and the player does not own.

To know whether the player has the money or do not use : getPlayerMoney.

Well lets make it easier.

function payDay () 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday",getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler ( "onResourceStart",resourceRoot, payDay ) 
  
setTimer(function() 
    outputChatBox ( "#DDA0DD--PAYDAY--",getRootElement(), 255,0,0, true ) 
    outputChatBox ( "#708090Pagamento: 2000$",getRootElement(), 255,0,0, true ) 
    outputChatBox ( "#708090Imposto Cobrado: 200$",getRootElement(), 255,0,0, true ) 
for I,v in ipairs(getElementsByType('player')) do 
    givePlayerMoney (v,2000 ) 
    takePlayerMoney (v,200 ) 
    end 
end, 6000000, 1) 

Only changed root element :D

Link to comment
-- Server Side #

function payDay () 
    for _,v in ipairs(getElementsByType("player")) do 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday",v, 255, 0, 0, true ) 
    end 
end 
addEventHandler ( "onResourceStart",resourceRoot, payDay ) 
  
setTimer(function() 
    for I,v in ipairs(getElementsByType('player')) do 
    outputChatBox ( "#DDA0DD--PAYDAY--",v, 255,0,0, true ) 
    outputChatBox ( "#708090Pagamento: 2000$",v, 255,0,0, true ) 
    outputChatBox ( "#708090Imposto Cobrado: 200$",v, 255,0,0, true ) 
    givePlayerMoney (v,2000 ) 
    takePlayerMoney (v,200 ) 
    end 
end, 6000000, 1) 

Note : Money will become a "negative '-' " if 200 was withdrawn and the player does not own.

To know whether the player has the money or do not use : getPlayerMoney.

Well lets make it easier.

function payDay () 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday",getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler ( "onResourceStart",resourceRoot, payDay ) 
  
setTimer(function() 
    outputChatBox ( "#DDA0DD--PAYDAY--",getRootElement(), 255,0,0, true ) 
    outputChatBox ( "#708090Pagamento: 2000$",getRootElement(), 255,0,0, true ) 
    outputChatBox ( "#708090Imposto Cobrado: 200$",getRootElement(), 255,0,0, true ) 
for I,v in ipairs(getElementsByType('player')) do 
    givePlayerMoney (v,2000 ) 
    takePlayerMoney (v,200 ) 
    end 
end, 6000000, 1) 

Only changed root element :D

You can use root element to give-take money it'll return for the player.

Link to comment
function payDay ( thePlayer, commandName, theLevel) 
         outputChatBox ( "#DDA0DD[PAYDAY] Ativaram o Payday",getRootElement(), 255, 0, 0, true ) 
end 
addEventHandler ( "onResourceStart",resourceRoot, payDay ) 
  
setTimer(function() 
        local account = getPlayerAccount ( thePlayer ) 
                local theLevel = 1 ( theLevel ) or 1 
        exports.exp_system:setAccountLevel ( account, theLevel ) 
    end 
) 
    outputChatBox ( "#DDA0DD--PAYDAY--",getRootElement(), 255,0,0, true ) 
    outputChatBox ( "#708090Pagamento: 2000$",getRootElement(), 255,0,0, true ) 
    outputChatBox ( "#708090Imposto Cobrado: 200$",getRootElement(), 255,0,0, true ) 
    outputChatBox ( "#708090Você ganhou um Level",getRootElement(), 255,0,0, true ) 
for I,v in ipairs(getElementsByType('player')) do 
    givePlayerMoney (v,2000 ) 
    takePlayerMoney (v,200 ) 
    end 
end, 6000000, 1) 

Okay, but now I wish every one player Payday gain a level I am using the system xp / level of Castillo https://wiki.multitheftauto.com/wiki/Resource:Exp_system

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