Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])
My?l?, ?e teraz powinno by? okej.
Kliknij, aby zobaczy? obrazek
[XML]<?xml version="1.0" encoding="UTF-8"?>
<mod name="Task System" version="1.0" author="buchaLL" contact="https://tibia.net.pl/members/353628-buchaLL" enabled="yes">
<config name="task_system_conf"><=!=[=C=D=A=T=A=[
onlyOneTime = true
mainStorage = 73435
task = {
['dragon'] = {storage = 5756, beginStorageValue = 1, finishStorageValue = 2, count = 1,
addons = {male = 128, female = 136, which = 3}}
}
function isSummon(cid)
if(not isCreature(cid)) then
return false
end
return getCreatureMaster(cid) ~= cid
end
]=]=></config>
<talkaction words="!task" event="script"><=!=[=C=D=A=T=A=[
domodlib('task_system_conf')
function onSay(cid, words, param, channel)
local taskMenu, message = task[param:lower()], ''
if taskMenu and (getCreatureStorage(cid, taskMenu.storage) == -1 or getCreatureStorage(cid, mainStorage) < 1) then
if(onlyOneTime and getCreatureStorage(cid, taskMenu.storage) > 0) or getCreatureStorage(cid, taskMenu.storage) > taskMenu.count then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Already you have made this task!')
end
if getCreatureStorage(cid, taskMenu.storage) > -1 then
return true
else
doCreatureSetStorage(cid, mainStorage, taskMenu.beginStorageValue)
end
doCreatureSetStorage(cid, taskMenu.storage, 0)
for k, v in pairs(task) do
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You must kill ' .. v.count .. ' ' .. k:lower() .. (v.count == 1 and '' or 's') .. '.')
end
elseif taskMenu and (getCreatureStorage(cid, taskMenu.storage) == 1 or getCreatureStorage(cid, mainStorage) >= 1) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You are already doing some task!')
elseif isInArray({'cancel'}, param:lower()) and getCreatureStorage(cid, mainStorage) > 0 then
for _, v in pairs(task) do
if getCreatureStorage(cid, v.storage) >= 0 then
doCreatureSetStorage(cid, mainStorage, -1)
doCreatureSetStorage(cid, v.storage, -1)
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You canceled the current task.')
end
end
elseif isInArray({'reward'}, param:lower()) then
for _, v in pairs(task) do
if (getCreatureStorage(cid, v.storage) == v.count or getCreatureStorage(cid, mainStorage) == v.finishStorageValue) then
doCreatureSetStorage(cid, v.storage, v.count + 1)
if(getPlayerSex(cid) == 0) then
doPlayerAddOutfit(cid, v.addons.female, v.addons.which)
else
doPlayerAddOutfit(cid, v.addons.male, v.addons.which)
end
doCreatureSetStorage(cid, mainStorage, -1)
doCreatureSetStorage(cid, v.storage, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Addon added!')
else
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have not finished your task yet!')
end
end
end
for k, v in pairs(task) do
if (getCreatureStorage(cid, v.storage) <= v.count or isInArray({v.finishStorageValue, v.beginStorageValue}, getCreatureStorage(cid, mainStorage))) then
return true
else
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have not started any task!')
end
end
end
]=]=></talkaction>
<event type="kill" name="talkactionTask" event="script"><=!=[=C=D=A=T=A=[
domodlib('task_system_conf')
function onKill(cid, target)
if isPlayer(target) or getCreatureMaster(target) or isNpc(target) then
return true
end
for k, v in pairs(task) do
if k:lower() == getCreatureName(target):lower() then
if getCreatureStorage(cid, mainStorage) == v.beginStorageValue then
if getCreatureStorage(cid, v.storage) < v.count then
doCreatureSetStorage(cid, v.storage, getCreatureStorage(cid, v.storage) + 1)
s = 'You killed ' .. getCreatureStorage(cid, v.storage) .. ' of ' .. v.count .. ' ' .. k:lower() .. (v.count == 1 and '' or 's') .. '.'
if getCreatureStorage(cid, v.storage) == v.count then
doCreatureSetStorage(cid, mainStorage, v.finishStorageValue)
s = 'Congratulations! You have killed enough '.. k:lower() ..'.'
end
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, s)
end
end
end
end
return true
end
]=]=></event>
<event type="login" name="taskEventLogin" event="buffer"><=!=[=C=D=A=T=A=[
registerCreatureEvent(cid, 'talkactionTask')
]=]=></event>
</mod>[/XML]
Teraz Git tylko mam jeszcze jedno pytanie da si? doda? tutaj exhaust na komendy oraz mo?liwo?? wykonania taska tylko raz ? I jak doda? nowego taska ? bo np dodaje na dragon lordy ale po napisaniu !task dragon lord to jest napisane ?e zacz??em taska na dragony a nie dragon lordy, ale mimo wszystko zalicza mi dl'e