Hello. I've been bored so I decided to make a script that gives a punishment to people that use offensive words.
How it works?
If a player says an offensive word (e.g "fuck") he will be given a warning at first. Then he'll be jailed, then warned again and then banished. Simple eh?
How do I implement that?
Add this script in the talkactions folder:
anti-insult.lua -
And then in talkactions.xml add this:
Do not forget to change these:
If you wish to add more offensive words then do the following:
Add this in talkactions.xml:
and then change "offensivewordshere" to the offensive word (or words) you want (e.g "fuck off").
If you have any question, feel free to post.
How it works?
If a player says an offensive word (e.g "fuck") he will be given a warning at first. Then he'll be jailed, then warned again and then banished. Simple eh?
How do I implement that?
Add this script in the talkactions folder:
anti-insult.lua -
Lua:
-- Advanced Anti-Insult script by KuGaSh1rA --
local JailTime = 1000 * 60 * 60
local OffenseStorage = 20000
local JailPosition = {x = 1000, y = 1000, z = 7}
local UnjailPosition = {x = 1000, y = 1000, z = 7}
local BanTime = 24 * 60 * 60
local BanDelayAfterFYI = 1000 * 10
local DamageOnOffense = -500
function onSay(cid, words, param)
if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then
if getPlayerStorageValue(cid, OffenseStorage) == -1 then
doPlayerSendTextMessage(cid, 19, "Insulting another player is not allowed. In the next offense you will be jailed.")
setPlayerStorageValue(cid, OffenseStorage, 1)
elseif getPlayerStorageValue(cid, OffenseStorage) == 1 then
doPlayerSendTextMessage(cid, 19, "Insulting another player is not allowed. You have been jailed.")
setPlayerStorageValue(cid, OffenseStorage, 2)
doTeleportThing(cid, JailPosition)
addEvent(Unjail, JailTime, cid)
elseif getPlayerStorageValue(cid,OffenseStorage) == 2 then
doPlayerSendTextMessage(cid, 19, "Insulting another player is not allowed. This is your last warning.")
setPlayerStorageValue(cid, OffenseStorage, 3)
elseif getPlayerStorageValue(cid, OffenseStorage) == 3 then
setPlayerStorageValue(cid, OffenseStorage, -1)
if doPlayerPopupFYI(cid, "You have been banished for offending another player.") then
addEvent(BanPlayer, BanDelayAfterFYI, cid)
end
end
else
doCreatureAddHealth(cid, DamageOnOffense)
doPlayerSendTextMessage(cid, 19, "Insulting while being in combat makes you hurt.")
end
end
function Unjail(cid)
doTeleportThing(cid, UnjailPosition)
doPlayerSendTextMessage(cid, 19, "You are free to go. If you insult again you'll have only a final warning and then a banishment.")
end
function BanPlayer(cid)
local playerName = getCreatureName(cid)
local pAcc = getAccountIdByName(playerName)
doAddBanishment(pAcc, BanTime, 4, 2, "Automatic Banishment for Offensive Statement")
doRemoveCreature(cid)
end
And then in talkactions.xml add this:
HTML:
<talkaction words="bitch" event="script" value="anti-insult.lua"/>
<talkaction words="fag" event="script" value="anti-insult.lua"/>
<talkaction words="bastard" event="script" value="anti-insult.lua"/>
Do not forget to change these:
Lua:
local JailPosition = {x = 1000, y = 1000, z = 7}
local UnjailPosition = {x = 1000, y = 1000, z = 7}
local JailTime = 1000 * 60 * 60
local BanTime = 24 * 60 * 60
local BanDelayAfterFYI = 1000 * 10
local DamageOnOffense = -500
If you wish to add more offensive words then do the following:
Add this in talkactions.xml:
HTML:
<talkaction words="offensivewordshere" event="script" value="anti-insult.lua"/>
and then change "offensivewordshere" to the offensive word (or words) you want (e.g "fuck off").
If you have any question, feel free to post.
Last edited: