Jump to content

Help


Recommended Posts

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?

Link to comment

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) 
  

Link to comment

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) 
  

Link to comment
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 
  

Link to comment

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