ID:263689
 
Okay i made this code and how would i be able to add a retain amount of characters? every code i can think of says i have an error

var
spam_limit = 15
spam_time = 20 // This makes sure you can't spam

mob/verb/OOC(text as text)
set category = "Communications"
// text = Cheatcode(src, text)
if(!text) return
if(spoken >= spam_limit)
usr << "<b><Font Color = Red>Shut Up Spamer</font>"
return 0
world << "<B>[usr] OOC</B>: [text]"
usr.spoken += 1


mob/verb/Say(text as text)
set category = "Communications"
// text = Cheatcode(src, text)
if(!text) return
if(spoken >= spam_limit)
usr << "<b><Font Color = Red>Shut Up Spamer</font>"
return 0
view() << "[usr] Says: [text]"
usr.spoken += 1








//Spam Guard

mob
var/spoken = 0
proc/Spoken(mob/M,N as num)
if(M.spoken >= spam_limit)
usr << "<b><Font Color = Red>SHUT UP</font>"

proc/Spam_Less()
spoken = max(0,spoken-1)
spawn(spam_time) Spam_Less()
mob
New()
..()
spawn(spam_time) Spam_Less()

//Debugging
//mob/Stat()
// statpanel("Spammy")
// stat("Current_Spam",usr.spoken)


Please Help me
You need to elaborate. "how would I be able to add a certain amount of characters" doesn't give us enough information to help you, and by characters do you mean keyboard chars or like player characters?
Instead of if(!text) you might want to try something a little trickier. Because all a user has to do is [space][enter] and it'll spam up the place.

You could use if(!ckey(text)) then it would minimise spam. But users would be pissed off because smilies like :) wouldn't be displayed.

My favourite method is removing spaces from text. if(!RemoveSpace(text)) return.
Make a proc which removes spaces from the text and use it. Unless others have a better suggestion.