Can someone make a /roll system for DarkRP? Just a chat command "/roll" and then it says blahblah rolls 67 or whatever?
[code]function RollRange(ply, PlayerName)
if timers != nil then
local timers = timers
else timers = 0
end
if timers > CurTime() - 5 then ply:SendLua('chat.AddText(Color(255,255,255),"Please wait before rolling again!")') return end
local col = team.GetColor(ply:Team())
local ents = ents.FindInSphere(ply:EyePos(), 250)
local filter = RecipientFilter()
filter:RemoveAllPlayers()
for k, v in pairs(ents) do
if v:IsPlayer() then
filter:AddPlayer(v)
end
end
timers = CurTime()
umsg.Start("Roll_Range", filter)
umsg.String(PlayerName)
umsg.Entity(ply)
umsg.Short(col.r)
umsg.Short(col.g)
umsg.Short(col.b)
umsg.End()
end
function Roll(ply, callback)
RollRange(ply, ply:Name())
end
AddChatCommand("/roll", Roll)
local function RollUSMG(msg)
local name = msg:ReadString()
local ply = msg:ReadEntity()
local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local rolled = math.random(0,100)
chat.AddText(Color(col1.r,col1.g,col1.b), name ,Color(255,255,255)," rolled " .. rolled .. " out of 100!")
end
usermessage.Hook("Roll_Range", RollUSMG)[/code]Old script which i found by my friend, copy&paste to chat.lua, i'm really not sure does it work.
Sorry, you need to Log In to post a reply to this thread.