~DarkRacer~ Posted March 8, 2013 Posted March 8, 2013 local trueNumber = 0 local price = 0 addCommandHandler("spin", function(theplayer, command, number, amount) number = tonumber(number) amount = tonumber(amount) if (number > 0) then if (amount >= 1000 and amount <= 1000000) then outputChatBox("#999999Your spin #ff5500("..number..") #999999is on the Wheel...", theplayer,255,255,255,true) trueNumber = math.random(1,65) outputChatBox(trueNumber) setTimer(checkspin,7000,1,number,trueNumber, amount, theplayer) spin = false setTime( function() spin = true end, 20000,1) else outputChatBox("Minimum spin amount is '1000' to '1000000'.", theplayer,255,0,0,true) end else outputChatBox("Minimum spin number is '1' to '65'.", theplayer,255,0,0,true) end end ) function checkspin(oldnumber, newnumber, amount, theplayer) if (oldnumber == newnumber) then price = amount * 100 outputChatBox("#0088ff"..getPlayerName(theplayer).." Spins #ff8800("..oldnumber..")#0088ff and wins #ff8800($"..price..")#0088ff!",getRootElement(),255,255,255,true) else outputChatBox("#0088ff"..getPlayerName(theplayer).." Spins #ff8800("..oldnumber..")#0088ff and loses.",getRootElement(),255,255,255,true) end end This is my spin system it's not finished yet but i need help i want to make that when the player execute the command /spin, i want him not to be able to spin again if a 20 sec. didn't passed. how would i do that?
PaiN^ Posted March 8, 2013 Posted March 8, 2013 You can use setTimer . " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
~DarkRacer~ Posted March 8, 2013 Author Posted March 8, 2013 i already did but it didn't work with me
Castillo Posted March 8, 2013 Posted March 8, 2013 You can use tables and getTickCount, you need to store the current tick count when the player spins, then when he tries to spin again, it'll check if the time has passed. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Anony# Posted March 9, 2013 Posted March 9, 2013 you can use it function Spins() if spam then outputChatBox('Wait 20 the 2nd',root,255,0,0,true) return end outputChatBox('Your spin ..',root,255,255,255,true) spam = true setTimer(function() Spins = {} spam = false end ,20000,1) end addCommandHandler("spin", Spins) Team, MTA Scripters.
Castillo Posted March 9, 2013 Posted March 9, 2013 Timers aren't efficient. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Anony# Posted March 9, 2013 Posted March 9, 2013 Timers aren't efficient. what do you mean by "not effective?" Team, MTA Scripters.
Anderl Posted March 9, 2013 Posted March 9, 2013 Timers are laggy. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
~DarkRacer~ Posted March 10, 2013 Author Posted March 10, 2013 there is another problem i can't get the current player's money... i don't know why but it returns a false value!! i use this : local money = 0 addCommandHandler("spin", function(theplayer, command, number, amount) money = getPlayerMoney(theplayer) outputChatBox(money) end)
Anderl Posted March 10, 2013 Posted March 10, 2013 Show 'meta.xml' file. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
~DarkRacer~ Posted March 10, 2013 Author Posted March 10, 2013 <meta> <script src="server.lua" type="server" /> </meta>
PaiN^ Posted March 10, 2013 Posted March 10, 2013 Where is the info line ..? " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
iPrestege Posted March 10, 2013 Posted March 10, 2013 Where is the info line ..? The info line is not needed every topic u say where's the info line lol?
~DarkRacer~ Posted March 10, 2013 Author Posted March 10, 2013 Where is the info line ..? lol the info line is not required in fact i won't waste my time filling up a stupid information that i won't need () so is there any solution for the get money function?
iPrestege Posted March 10, 2013 Posted March 10, 2013 u wan't just get you're money or all player's on the server by player name?
PaiN^ Posted March 10, 2013 Posted March 10, 2013 The info line is not needed the info line is not required in fact ... Sorry, I didn't know that .. " Keep Thinking Different . " - Steve Jops -------------------- Don't send me PMs asking for help, I Won't reply !
iPrestege Posted March 10, 2013 Posted March 10, 2013 No problem but i mean the meta.xml just need the main file's .
~DarkRacer~ Posted March 10, 2013 Author Posted March 10, 2013 u wan't just get you're money or all player's on the server by player name? i want to get the money of the player who executed the command /spin.
iPrestege Posted March 10, 2013 Posted March 10, 2013 Like this? -- Server -- addCommandHandler("spin", function (thePlayer) money = getPlayerMoney(thePlayer) outputChatBox(" "..money.." ") end)
~DarkRacer~ Posted March 10, 2013 Author Posted March 10, 2013 Like this?-- Server -- addCommandHandler("spin", function (thePlayer) money = getPlayerMoney(thePlayer) outputChatBox(" "..money.." ") end) Yes but it's not working for me i don't know why it output on chat "false"! local trueNumber = 0 local price = 0 local money = 0 addCommandHandler("spin", function(theplayer, command, number, amount) number = tonumber(number) amount = tonumber(amount) money = getPlayerMoney(thePlayer) if (number > 0) then if (amount >= 1000 and amount <= 1000000) then outputChatBox("#999999Your spin #ff5500("..number..") #999999is on the Wheel...", theplayer,255,255,255,true) trueNumber = math.random(1,65) outputChatBox(money, theplayer,255,255,255,true) -- Returns FALSE !! setTimer(checkspin,10000,1,number,trueNumber, amount, theplayer) else outputChatBox("Minimum spin amount is '1000' to '1000000'.", theplayer,255,0,0,true) end else outputChatBox("Minimum spin number is '1' to '65'.", theplayer,255,0,0,true) end end ) function checkspin(oldnumber, newnumber, amount, theplayer) if (oldnumber == newnumber) then price = amount * 100 outputChatBox("#0088ff"..getPlayerName(theplayer).." Spins #ff8800("..oldnumber..")#0088ff and wins #ff8800($"..price..")#0088ff!",getRootElement(),255,255,255,true) else outputChatBox("#0088ff"..getPlayerName(theplayer).." Spins #ff8800("..newnumber..")#0088ff and loses.",getRootElement(),255,255,255,true) end end
~DarkRacer~ Posted March 10, 2013 Author Posted March 10, 2013 theplayer and you put theP. omg thank you Pres[T]ege.
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