Steve_Rogerzz Posted May 27, 2021 Share Posted May 27, 2021 -- 1352 , -1769 , 14 function storerob() --if x <= 1356 and x >= 1348 then --if y <= -1773 and y >= -1765 then --outputChatBox("you are here ", player, 0, 0, 0) function announce() --------------------------------------------------------------------------------------------- outputChatBox(" ", root, 0, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox("[ALERT] Someone has breaked the Locker in Store !!", root, 255, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox(" ", root, 0, 0, 0) --------------------------------------------------------------------------------------------- end function loope() outputChatBox("Robbing the money ...", player, 0, 255, 0) end --------------------------------------------------------------------------------------------- function money2() money = math.random(200000, 400000) givePlayerMoney( player, money ) outputChatBox(" ", player, 0, 0, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox("You got $"..money.." by robbing a Store !! ", player, 0, 255, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox(" ", player, 0, 0, 0) givePlayerMoney( player, money ) end --------------------------------------------------------------------------------------------- announce() loope() money2() --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end end addCommandHandler("robstore", storerob) Link to comment
Tekken Posted May 27, 2021 Share Posted May 27, 2021 Most likely loope() and money2() player argument not passed through the function You will need to pass the player like this loope( player ) money2( player ) Link to comment
Tekken Posted May 27, 2021 Share Posted May 27, 2021 edit: moved the topic to scripting section for best results! Link to comment
Steve_Rogerzz Posted May 28, 2021 Author Share Posted May 28, 2021 Thank you so much ! Link to comment
Steve_Rogerzz Posted May 28, 2021 Author Share Posted May 28, 2021 but I got the same error again Link to comment
Tekken Posted May 28, 2021 Share Posted May 28, 2021 May I see the updated script? Correct form: function storerob(player commandName) -- define player in function! -- no need to create 50+ functions, everything can be done in the same function. local money = math.random(200000, 400000); outputChatBox(" ", root); outputChatBox("-----------------------------------------------------", root, 255, 0, 0); outputChatBox("[ALERT] Someone has breaked the Locker in Store !!", root, 255, 0, 0); outputChatBox("-----------------------------------------------------", root, 255, 0, 0); outputChatBox(" ", root); outputChatBox("Robbing the money ...", player, 0, 255, 0); outputChatBox(" ", player); outputChatBox("------------------------------------------------------", player, 0, 255, 0); outputChatBox("You got $"..money.." by robbing a Store !! ", player, 0, 255, 0); outputChatBox("------------------------------------------------------", player, 0, 255, 0); outputChatBox(" ", player); givePlayerMoney(player, money); end addCommandHandler("robstore", storerob); Link to comment
Steve_Rogerzz Posted May 29, 2021 Author Share Posted May 29, 2021 I need to make it a 5 min delay with settimer and loop the "Robbing the Money" here is the script which i modified -- 1352 , -1769 , 14 function storerob() --if x <= 1356 and x >= 1348 then --if y <= -1773 and y >= -1765 then --outputChatBox("you are here ", player, 0, 0, 0) --------------------------------------------------------------------------------------------- outputChatBox(" ", root, 0, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox("[ALERT] Someone has breaked the Locker in Store !!", root, 255, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox(" ", root, 0, 0, 0) --------------------------------------------------------------------------------------------- function loope(player) outputChatBox("Robbing the money ...", player, 0, 255, 0) end setTimer(loope, 1000, 29) --------------------------------------------------------------------------------------------- function money2(player) money = math.random(200000, 400000) givePlayerMoney( player, money ) outputChatBox(" ", player, 0, 0, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox("You got $"..money.." by robbing a Store !! ", player, 0, 255, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox(" ", player, 0, 0, 0) givePlayerMoney( player, money ) end --------------------------------------------------------------------------------------------- setTimer( money2, 30000, 1 ) --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end end addCommandHandler("robstore", storerob) Link to comment
Steve_Rogerzz Posted May 29, 2021 Author Share Posted May 29, 2021 I need to make it a 5 min delay with settimer and loop the "Robbing the Money" here is the script which i modified -- 1352 , -1769 , 14 function storerob() --if x <= 1356 and x >= 1348 then --if y <= -1773 and y >= -1765 then --outputChatBox("you are here ", player, 0, 0, 0) --------------------------------------------------------------------------------------------- outputChatBox(" ", root, 0, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox("[ALERT] Someone has breaked the Locker in Store !!", root, 255, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox(" ", root, 0, 0, 0) --------------------------------------------------------------------------------------------- function loope(player) outputChatBox("Robbing the money ...", player, 0, 255, 0) end setTimer(loope, 1000, 29) --------------------------------------------------------------------------------------------- function money2(player) money = math.random(200000, 400000) givePlayerMoney( player, money ) outputChatBox(" ", player, 0, 0, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox("You got $"..money.." by robbing a Store !! ", player, 0, 255, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox(" ", player, 0, 0, 0) givePlayerMoney( player, money ) end --------------------------------------------------------------------------------------------- setTimer( money2, 30000, 1 ) --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end end addCommandHandler("robstore", storerob) Link to comment
SpecT Posted May 29, 2021 Share Posted May 29, 2021 (edited) Maybe you didn't take a close look on what @Tekken posted. You are missing the argument "player" in the function storerob(). Also to make those timers work you will need to pass them the player element as well - as an optional argument (check setTimer documentation). It should be something like this: -- 1352 , -1769 , 14 function storerob(player) --if x <= 1356 and x >= 1348 then --if y <= -1773 and y >= -1765 then --outputChatBox("you are here ", player, 0, 0, 0) --------------------------------------------------------------------------------------------- outputChatBox(" ", root, 0, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox("[ALERT] Someone has breaked the Locker in Store !!", root, 255, 0, 0) outputChatBox("-----------------------------------------------------", root, 255, 0, 0) outputChatBox(" ", root, 0, 0, 0) --------------------------------------------------------------------------------------------- function loope(player) outputChatBox("Robbing the money ...", player, 0, 255, 0) end setTimer(loope, 1000, 29, player) --------------------------------------------------------------------------------------------- function money2(player) money = math.random(200000, 400000) givePlayerMoney( player, money ) outputChatBox(" ", player, 0, 0, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox("You got $"..money.." by robbing a Store !! ", player, 0, 255, 0) outputChatBox("------------------------------------------------------", player, 0, 255, 0) outputChatBox(" ", player, 0, 0, 0) givePlayerMoney( player, money ) end --------------------------------------------------------------------------------------------- setTimer(money2, 30000, 1, player) --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end --else --outputChatBox("You are not Near the Locker !!", player, 255, 0, 0) --end end addCommandHandler("robstore", storerob) *PS: Please, use the "code" tool in the text editor when you paste Lua code. Edited May 29, 2021 by SpecT Link to comment
Steve_Rogerzz Posted May 29, 2021 Author Share Posted May 29, 2021 it is working now ! thank you guys ! 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