Prodax Posted February 13, 2013 Posted February 13, 2013 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
csiguusz Posted February 13, 2013 Posted February 13, 2013 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
myonlake Posted February 13, 2013 Posted February 13, 2013 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!
Prodax Posted February 14, 2013 Author Posted February 14, 2013 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
DNL291 Posted February 14, 2013 Posted February 14, 2013 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.
Castillo Posted February 14, 2013 Posted February 14, 2013 "robbed" is nowhere defined, that code doesn't make any sense. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Moderators IIYAMA Posted February 15, 2013 Moderators Posted February 15, 2013 (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 February 15, 2013 by Guest Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
ViRuZGamiing Posted February 15, 2013 Posted February 15, 2013 Isn't that a Server Sided script? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Moderators IIYAMA Posted February 15, 2013 Moderators Posted February 15, 2013 (edited) Thx @TAPL Omg I failed....... -_-" Updated x3. Edited February 15, 2013 by Guest Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
TAPL Posted February 15, 2013 Posted February 15, 2013 givePlayerMoney client side doesn't require player element. outputChatBox client side doesn't require player element.
Castillo Posted February 15, 2013 Posted February 15, 2013 Giving money client side won't sync it with the server, you must do it server side. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Moderators IIYAMA Posted February 15, 2013 Moderators Posted February 15, 2013 -- 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. 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 Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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