Witajcie,
Kiedy? na pewnym serwerze zauwa?y?em ciekawe rozwi?zanie, gracz kt?ry u?y? przekle?stwa dostawa? mute na 2 minuty, oczywi?cie zainspirowa?o mnie to do stworzenia takiego skryptu.
Wersja 1 (Uproszczona):
Zaczynamy od edycji pliku talkactions.xml, dodaj?c:
Teraz w folderze talkactions/scripts tworzymy plik cenzura.lua
Wersja 2 (System Ostrze?e?):
System ostrze?e? + kary za przekle?stwa (Mute, Ban, Odejmowanie leveli), + sprawdzanie ostrze?e? + usuwanie ostrze?e? za GP
Tak jak poprzednio zaczynamy od edycji pliku talkactions.xml, dodaj?c:
talkactions/scripts/cenzura.lua
(Oczywi?cie mo?esz doda? wi?cej przekle?stw, wystarczy ?e skopiujesz powy?sz? linijk? a w miejsce s?owa "kurwa" wstawisz inne brzydkie s??wko)
Usuwanie Ostrze?e?:
W talkactions.xml dodajemy:
talkactions/scripts/removewarnings.lua
Sprawdzanie Ostrze?e?:
talkactions.xml
talkactions/scripts/warnings.lua
Funkcja doPlayerAddLevel (BY KERAXEL)
Je?eli s? jakie? b??dy, to pisa?.
Kiedy? na pewnym serwerze zauwa?y?em ciekawe rozwi?zanie, gracz kt?ry u?y? przekle?stwa dostawa? mute na 2 minuty, oczywi?cie zainspirowa?o mnie to do stworzenia takiego skryptu.
Wersja 1 (Uproszczona):
Zaczynamy od edycji pliku talkactions.xml, dodaj?c:
PHP:
<talkaction words="kurwa" script="cenzura.lua" />
Teraz w folderze talkactions/scripts tworzymy plik cenzura.lua
PHP:
local czas = 2*60*1000
local mute = createConditionObject(CONDITION_MUTED)
setConditionParam(mute,CONDITION_PARAM_TICKS,czas)
function onSay(cid, words, param)
doSendAnimatedText(getPlayerPosition(cid), "MUTED!", 193)
doPlayerSendTextMessage (cid, 22, "You have been muted for 2 minutes. Don\'t say " .. words .. " again !")
doSendMagicEffect(getPlayerPosition(cid), 13)
doAddCondition(cid,mute)
return true
end
Wersja 2 (System Ostrze?e?):
System ostrze?e? + kary za przekle?stwa (Mute, Ban, Odejmowanie leveli), + sprawdzanie ostrze?e? + usuwanie ostrze?e? za GP
Tak jak poprzednio zaczynamy od edycji pliku talkactions.xml, dodaj?c:
PHP:
<talkaction words="kurwa" script="cenzura.lua" />
talkactions/scripts/cenzura.lua
PHP:
local config = {
storage = 43435,
maxwarnings = 5, -- Ile ostrzezen musi dostac gracz aby zostal zbanowany
banstatus = 1, -- czy gracz ma byc banowany po osiagnieciu maksymalnej ilosci ostrzezen
bantime = 180, -- Czas bana (w minutach) - Tylko jezeli banstatus = 1
leveldownstatus = 0, -- 1 on /0 off Uwaga!! wymagana funkcja doPlayerAddLevel
leveldown = -1, -- ile leveli ma tracic gracz po osiagnieciu maksymalnej ilosci ostrzezen - Tylko jezeli leveldownstatus = 1
}
local czas = 1*60*1000 -- 1 = na ile minut gracz dostanie mute
local mute = createConditionObject(CONDITION_MUTED)
setConditionParam(mute,CONDITION_PARAM_TICKS,czas)
function onSay(cid, words, param)
local warnings = getPlayerStorageValue(cid, config.storage)
if(warnings == -1) then
warnings = 1
end
setPlayerStorageValue(cid, config.storage, warnings + 1)
doSendAnimatedText(getPlayerPosition(cid), "MUTED!", 193)
doPlayerSendTextMessage (cid, 22, "You have been warned! \n You have " .. warnings .. " warnings of " .. config.maxwarnings .. " allowed. If you reach the maximum " .. config.maxwarnings .. " warnings, you will be banned for " .. config.bantime .. " minutes.")
doSendMagicEffect(getPlayerPosition(cid), 13)
doAddCondition(cid,mute)
if(warnings >= config.maxwarnings) then
setPlayerStorageValue(cid, config.storage, 1)
end
if(config.leveldownstatus == 1) then
doPlayerAddLevel(cid, config.leveldown)
end
if(config.banstatus == 1) then
doAddBanishment(getAccountNumberByName(getPlayerName(cid)), config.bantime, 4, 2, 'You reach the '.. config.maxwarnings ..' warnings.\nYour account has been banned for '.. config.bantime ..' minutes', 2)
doRemoveCreature(cid)
end
reutrn true
end
(Oczywi?cie mo?esz doda? wi?cej przekle?stw, wystarczy ?e skopiujesz powy?sz? linijk? a w miejsce s?owa "kurwa" wstawisz inne brzydkie s??wko)
Usuwanie Ostrze?e?:
W talkactions.xml dodajemy:
PHP:
<talkaction words="!removewarnings" script="removewarnings.lua" />
talkactions/scripts/removewarnings.lua
PHP:
local config = {
storage = 43435,
cost = 1000, -- Ile kosztuje usuniecie jednego ostrzezenia
}
function onSay(cid, words, param)
local warnings = getPlayerStorageValue(cid, config.storage)
if(warnings == 1) then
doPlayerSendCancel (cid, "Sorry, you don\'t have any warnings!")
end
if(doPlayerRemoveMoney(cid, config.cost*warnings - config.cost) == false) then
doPlayerSendCancel (cid, "You don\'t have money to remove your warnings.")
end
if(warnings > 1) then
doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, 'Your all warnings has been deleted')
setPlayerStorageValue(cid, config.storage, 1)
end
return TRUE
end
Sprawdzanie Ostrze?e?:
talkactions.xml
PHP:
<talkaction words="!warnings" script="warnings.lua" />
talkactions/scripts/warnings.lua
PHP:
local config = {
storage = 43435,
maxwarnings = 5
}
function onSay(cid, words, param)
local warnings = getPlayerStorageValue(cid, config.storage)
if(warnings == -1) then
warnings = 1
end
if(warnings >= 1) then
warnings = warnings -1
end
doPlayerSendTextMessage (cid, 22, "You have " .. warnings .. " warnings of " .. config.maxwarnings .. " allowed.")
return TRUE
end
Funkcja doPlayerAddLevel (BY KERAXEL)
PHP:
function doPlayerAddLevel(cid, amount)
return doPlayerAddExperience(cid, getExperienceForLevel(getPlayerLevel(cid) + amount) - getPlayerExperience(cid)) or FALSE
end
Je?eli s? jakie? b??dy, to pisa?.