• Thanks
    1 replies, posted
Thanks so much you really helped me.
If you don't understand something don't be afraid to ask. [lua] hook.Add("PlayerSay", "RandomNumber", function(ply, text, public) local check = string.Explode(" ", text) local cmd = check[1] if cmd != "/random" then return text end if #check > 3 then ply:ChatPrint("You can only have a range between 2 numbers!") return "" end local num1 = tonumber(check[2]) local num2 = tonumber(check[3]) if num1 == nil or num2 == nil then ply:ChatPrint("The correct way is: /random <num1> <num2>") return "" end num1 = math.floor(num1) num2 = math.floor(num2) if num1 >= num2 then ply:ChatPrint("The first number has to be lower than the second number.") return "" end local randomNum = math.random(num1,num2) local plys = player.GetAll() for i = 1, #plys do local v = plys[i] if v != ply then v:ChatPrint(ply:Nick().." got the number "..randomNum.." from the range of "..num1.." to "..num2..".") else ply:ChatPrint("You got the number "..randomNum.." from the range of "..num1.." to "..num2..".") end end return "" end) [/lua]
Sorry, you need to Log In to post a reply to this thread.