Need with help with a roll command

Alright so I have a roll command that I found that works perfectly. Only problem that I have with it is that players can use /me to make it look like they won. I want it to say [Roll] before the nickname, and I haven’t been able to get it working. I am using the darkrp base for the code.

Here’s what it looks like on its own: General Guy has rolled a 91.

I want to change it to where it looks like [Roll] General Guy has rolled a 91.

Yes, the core darkrp files were edited for this. Can anyone provide a solution for me?


local function Roll(ply, args)
	local DoSay = function()
		if GAMEMODE.Config.alltalk then
			for _, target in pairs(player.GetAll()) do
              DarkRP.talkToPerson(target, team.GetColor(ply:Team()), "[Roll]"..ply:Nick().." has rolled a "..math.random(1,100)..".")
            end
        else
            DarkRP.talkToRange(ply, "[Roll]"..ply:Nick().." has rolled a "..math.random(1,100)..".", "", 250)
		end
	end
	return args, DoSay
end
DarkRP.defineChatCommand("roll", Roll, 1.5)

Where tje hell is that called i dont know. But there are basic function like printmessage or others to print text to the chat. I cant understand why you use talktorange if u dont know how to use it. Better use that roll thing in server side. But you can u se it one client side also but nees chat add text. Just use gmod wiki there are many guides many functions that can help you. Dunno why need player.getal so weird. Maybe for the talk range thing not all ppl get message. :l

Also u use 2 math.random just use 1 outside of calling talk. But not outside of the roll local function. U need the same roll for all players right?

Um, I don’t even know what you said. As I said, I didn’t make this line of code, I just want to modify it to where it says: [Roll] General Guy has rolled a 12.

jesus christ thats basically just dakrp functions



local function Roll(ply, args)
     local name = ply:Name()
     local num = math.random(1,100)

     for k,v in ipairs( ents.FindByClass("player") ) do
          v:SendLua( [[chat.AddText( Color(255,0,0), "[Roll] "..name.." rolled a "..num.."!" )]]  )
     end
end
DarkRP.defineChatCommand("roll", Roll, 1.5)

this should work, i presume this is being called serverside

Nah, I said fuck it and made a module in the darkrp. I got it working using local emote.