Whenever I say that "farget" word, it says it added 745 to my SwearCount and booted me from the game. Why?! It's only supposed to add 25! >.<
Code:
mob
tmp/SpamNumber = 0
tmp/SpamMax = 4
tmp/SpamTime = 30
tmp/SwearCount = 0
proc/SwearFilter(msg)
var/list/BannedWords = list("ace"=90)
var/list/VulgarSwears = list("farget"=25)
var/Count = 0
var/Index
var/Swear
for(Swear in VulgarSwears)
Index = findtext(msg,Swear)
while(Index)
Count += VulgarSwears[Swear]
Index = findtext(msg,Swear,Index+length(Swear))
for(Swear in BannedWords)
Index = findtext(msg,BannedWords)
while(Index)
Count += BannedWords[Swear]
Index = findtext(msg,Swear,Index+length(Swear))
return Count
mob/verb
World\-Chat(msg as text)
set hidden = 1
set src = usr
if(usr.Muted)
alert("You are muted! Shut up!")
return
if(!msg) return
if(length(msg) > 150)
alert("Your messege is too long. Please shorten it!")
return
if(!usr.Staff)
if((++usr.SpamNumber) >= SpamMax)
world<<"<center>[usr] has been kicked from the game for either spamming messages or talking too fast!"
del(usr)
return
spawn(SpamTime) --usr.SpamNumber
var/SwearScore = SwearFilter(msg)
if(SwearScore > 0)
usr.SwearCount += SwearScore
usr<<"<font size=+1><font color=red>Your warning level has gone up [SwearScore]!"
if(usr.SwearCount >= 100)
world<<"<center>[usr] has been kick from the game for either excessive swearing or using out of date insults!"
del(usr)
return
else usr.SwearCount-=10
msg = copytext(msg,1,findtext(msg,"\n"))
world<<"<b>[usr.GuildTag ? "<b>\[[usr.GuildTag]\]</b>" : ""] [usr]:</b> [html_encode(msg)]"