Jump to content

Bankrob-system


Prodax

Recommended Posts

Posted

I would like to ask for a bank robbery every 10 seconds which system would give the player $ 2,000. command :/ rob

  thank you very much

Posted

First try to do something yourself then if you have problmens we can help.

Some useful functions you may need:

givePlayerMoney 
setTimer 
addCommandHandler 

Owner of [HUN]Magyar Play Szerver 1.4, IP: 31.220.43.153:22003

Posted

You do realize that this is not a board where you come in without an intention to buy a script.

And those functions that csiguusz gave you are a good start for you.

If I helped you, please click the like button on the right ;) Thanks!

Posted
function rob(rob,thePlayer) 
  
 if (robbed==0) then 
            outputChatBox("Start robbed", source, 255, 194, 14) 
        elseif (robbed==1) then 
            outputChatBox("Finish Robbed", source, 255, 194, 14) 
         
        end 
    givePlayerMoney ( rob, 1000 ) 
    setTimer(rob, 10000, 0, source) 
     
end 
addCommandHandler( "rob",rob ) 

no god.Please help thank you

Posted
function rob(sourcePlayer, commandName) 
    setTimer( function() 
        if (robbed==0) then 
            outputChatBox("Start robbed", sourcePlayer, 255, 194, 14) 
        elseif (robbed==1) then 
            outputChatBox("Finish Robbed", sourcePlayer, 255, 194, 14) 
        end 
        givePlayerMoney( sourcePlayer, 2000 ) 
    end, 10000, 0 ) 
end 
addCommandHandler( "rob", rob ) 

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

"robbed" is nowhere defined, that code doesn't make any sense.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Moderators
Posted (edited)

-- client ..

  
local lastTickRob = 0 
function rob () 
      local tick = getTickCount () 
      local myTick = (tick-lastTickRob) 
      if 10000 < myTick then 
            lastTickRob = tick 
            givePlayerMoney( 2000 ) 
      else 
            outputChatBox(" You have to wait" .. math.ceil((10000-myTick)/1000) .. " secondes before you can rob the shop again.") 
      end 
addCommandHandler( "rob", rob ) 

Edited by Guest

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted (edited)

Thx

@TAPL

Omg I failed....... -_-"

Updated x3.

Edited by Guest

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

Giving money client side won't sync it with the server, you must do it server side.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

  • Moderators
Posted
-- client 
local lastTickRob = 0 
function rob () 
    local tick = getTickCount () 
    local myTick = (tick-lastTickRob) 
    if 10000 < myTick then 
        lastTickRob = tick 
        triggerServerEvent ( "giveMoneyRob", getLocalPlayer() ) 
    else 
        outputChatBox(" You have to wait " .. math.ceil((10000-myTick)/1000) .. " secondes before you can rob the shop again.") 
    end 
end 
addCommandHandler( "rob", rob ) 

  
--server 
addEvent( "giveMoneyRob", true ) 
addEventHandler( "giveMoneyRob", getRootElement(), 
function () 
if isElement(source) and not isPedDead ( source ) then 
 givePlayerMoney(source, 2000 ) 
end 
end) 
  
  

Well he can build it him self, I don't know anything about rpg and role-play servers any way.

But thank you for let me solve the problem. :wink:

test it and it works.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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