Prodax Posted February 13, 2013 Share 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 Link to comment
csiguusz Posted February 13, 2013 Share 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 Link to comment
myonlake Posted February 13, 2013 Share 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. Link to comment
Prodax Posted February 14, 2013 Author Share 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 Link to comment
DNL291 Posted February 14, 2013 Share 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 ) Link to comment
Castillo Posted February 14, 2013 Share Posted February 14, 2013 "robbed" is nowhere defined, that code doesn't make any sense. Link to comment
Moderators IIYAMA Posted February 15, 2013 Moderators Share 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 Link to comment
ViRuZGamiing Posted February 15, 2013 Share Posted February 15, 2013 Isn't that a Server Sided script? Link to comment
Moderators IIYAMA Posted February 15, 2013 Moderators Share Posted February 15, 2013 (edited) Thx @TAPL Omg I failed....... -_-" Updated x3. Edited February 15, 2013 by Guest Link to comment
TAPL Posted February 15, 2013 Share Posted February 15, 2013 givePlayerMoney client side doesn't require player element. outputChatBox client side doesn't require player element. Link to comment
Castillo Posted February 15, 2013 Share Posted February 15, 2013 Giving money client side won't sync it with the server, you must do it server side. Link to comment
Moderators IIYAMA Posted February 15, 2013 Moderators Share 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. Link to comment
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