- -- The words we want to block go here. Make sure they are all LOWER CASE!!
- exact_swear_table = {"fuck", "faggot", "shit", "cock", "fk", "fuk", "ass", "asswipe", "damn", "bastard", "dick", "dickk", "dickslap", "dicks", "dumass", "dumbass", "fag", "gayass", "gay", "homo", "ho", "whore", "mothafucka", "mothafuka", "motherfucker", "mofo", "ballsack", "nigga", "nigger", "pussy", "queerhole", "queer", "stfu", "testicle", "testicles", "testical", "testicles", "twat", "vagina", "wank"}
- anywhere_swear_table = {"fuck", "fag", "shit", "cock", "damn", "asswipe", "bitch", "goddamn", "goddamnit"}
- function GetRequiredVersion()
- return 10058
- end
- -- called when the script is loaded
- function OnScriptLoad(process)
- end
- -- called when the script is unloaded
- -- Do not return a value
- function OnScriptUnload()
- end
- -- called when a game is starting (before any players join)
- -- Do not return a value.
- function OnNewGame(map)
- end
- -- called when a game is ending
- -- Do not return a value.
- function OnGameEnd(mode)
- -- mode 1 = score menu (F1) is being displayed to clients, they are still ingame
- -- mode 2 = post game menu appeared
- -- mode 3 = players can quit via the post game score card
- end
- -- Called when there is chat within the server
- -- It must return a value which indicates whether or not the chat is sent.
- function OnServerChat(player, chattype, message)
- -- this is a LOCAL variable that we use to track whether or not to send the message to the server
- local AllowChat = 1
- -- get the number of tokens in the word
- local count = gettokencount(message, " ")
- --declare the new message variable
- local newmessage = ""
- -- loop through each word in the message (starting at 0 until count-1)
- for i = 0, count-1 do
- -- get the word
- local word = gettoken(message, " ", i)
- -- now loop through the swear table
- local exacttableSize = table.getn(exact_swear_table)
- local anywheretableSize = table.getn(anywhere_swear_table)
- local found = false
- -- loop through the table and check if the words match any substr
- for x = 1, exacttableSize do
- -- check if the word matches
- if string.lower(word) == exact_swear_table[x] then
- -- block the message
- AllowChat = 0
- --get the length of the word/phrase
- local length = string.len(exact_swear_table[x])
- --make a local variable storing ****s
- local stars = ""
- --insert the correct length of stars into the string
- for j = 1,length do
- stars = stars .. "*"
- end
- --replace the word with stars
- word = stars
- --already found the word, we do not need to check in the anywheretable
- found = true
- -- stop this loop as we need not continue
- break
- end
- end
- if AllowChat == 1 then
- for x = 1,anywheretableSize do
- -- check if the phrase is found anywhere in the word
- if string.find(string.lower(word), anywhere_swear_table[x]) ~= nil then
- --get the length of the word/phrase
- local length = string.len(anywhere_swear_table[x])
- --make a local variable storing ****s
- local stars = ""
- --insert the correct length of stars into the string
- for j = 1,length do
- stars = stars .. "*"
- end
- --replace the word with stars
- word = word:gsub(string.lower(anywhere_swear_table[x]), stars)
- word = word:gsub(string.upper(anywhere_swear_table[x]), stars)
- AllowChat = 0
- end
- end
- end
- if newmessage == "" then
- newmessage = word
- else
- newmessage = newmessage .. " " .. word
- end
- end
- if AllowChat == 0 then
- return newmessage
- end
- return AllowChat -- allow all chat, 0 would block the chat
- end
- -- Called when a server command is being executed
- -- It must return a value which indicates whether or not the command should be processed
- -- Note: It is only called when an authenticated (and allowed) player attempts to use the command.
- -- player is -1 when being executed via the server console.
- function OnServerCommand(player, command)
- return 1
- end
- -- Called when a player's team is being chosen as the join the server.
- -- It must return a value which indicates the team the player is to be put on.
- -- Note: this function being called doesn't guarantee that the player will be able to successfully join.
- function OnTeamDecision(cur_team)
- return cur_team
- end
- -- Called when a player joins the server.
- -- Do not return a value.
- function OnPlayerJoin(player, team)
- end
- -- Called when a player the server.
- -- Do not return a value.
- function OnPlayerLeave(player, team)
- end
- -- called when a player kills another, 'killer' is the index of the killing player, 'victim' is the index of the dead player
- -- Do not return a value.
- function OnPlayerKill(killer, victim, mode)
- end
- -- called when a player gets a double kill, killing spree etc
- function OnKillMultiplier(player, multiplier)
- -- values for multiplier
- --0x07 = double kill
- --0x09 = triple kill
- --0x0a = killtacular
- --0x0b = killing spree
- --0x0c = running riot
- --0x0d = betrayed
- --0x0e = killtacular with score
- --0x0f = triple kill with score
- --0x10 = double kill with score
- --0x11 = running riot with score
- --0x12 = killing spree with score
- end
- -- Called when a player spawns (after object is created, before players are notified)
- -- Do not return a value
- function OnPlayerSpawn(player, m_objectId)
- end
- -- Called after clients have been notified of a player spawn
- -- Do not return a value
- function OnPlayerSpawnEnd(player, m_objectId)
- end
- -- Called when a player is attempting to change team.
- -- A value must be returned. The return value indicates whether or not the player is allowed the change team.
- -- Notes: If relevant is 1 the return value is considered, if it's 0 then the return value is ignored.
- function OnTeamChange(relevant, player, team, dest_team)
- return 1
- end
- -- Called when a player interacts with an object
- -- It can be called while attempting to pick the object up
- -- It is also called when standing above an object so can be called various times quickly
- function OnObjectInteraction(player, m_ObjectId, tagType, tagName)
- return 1
- end
- -- Called when a player attempts to reload their weapon.
- -- A value must be returned. The return value indicates whether or not the player is allowed to reload.
- -- Notes: If player is -1 then the weapon being reload wasn't located (it could be a vehicle's weapon)
- function OnWeaponReload(player, weapon)
- return 1
- end
- -- Called when a player attempts to enter a vehicle.
- -- A value must be returned. The return value indicates whether or not the player is allowed to enter.
- function OnVehicleEntry(player)
- return 1
- end
- -- Called when damage is being done to an object. This doesn't always need to be a player.
- -- Do not return a value
- function OnDamageLookup(receiving_obj, causing_obj, tagdata, tagname)
- end
- -- Called when a player is being assigned a weapon (usually when they spawn)
- -- A value must be returned. The return value is the id of the weapon they're to spawn with. Return zero if the weapon shouldn't change.
- -- Notes: This is called for all spawn weapons the player has
- -- This is also called with player 255 when vehicles are being assigned weapons.
- -- This is only considered if in gametype, the weapon set is 'generic' if not this has no effect.
- function OnWeaponAssignment(player, object, count, tag)
- return 0
- end
- -- Called when a object is created, it may not always be for a player.
- -- Do not return a value.
- function OnObjectCreation(owningPlayer, owningObject, m_weapon, tag)
- end
- function OnClientUpdate(player, m_objectId)
- end
Recent Pastes