What's new

Actions Skrypty na zamówienie (lua, php, mysql, c++ [podstawy])

sempele

Active User
Joined
Nov 19, 2010
Messages
107
Reaction score
3
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

1.Rodzaj skryptu-
2.Opis skryptu:War mod z blaszkami
3.Wersja silnika: tfs 0.4
 

Mr ImaGu?

Advanced User
Joined
Dec 13, 2014
Messages
289
Reaction score
10
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu: lua
Opis skryptu: posiadam skrypt na npc promotion jednak nie dzia?a w nim "note2". Chcia?bym te? aby w wymaganiach, kt?rych zaznaczy?em na czerwono by?o te? wymagane storage z questa
Wersja silnika: Alissow server 9.83

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())
 

Kage Toxic

Banned
Joined
Feb 22, 2013
Messages
204
Reaction score
6
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

<b>Rodzaj skryptu:</b> SPELLS
<b>Opis skryptu:</b> Skrypt ma za zadanie leczy? tylko ludzi w party, lecz nie dzia?a, wyskakuje taki b??d: [13/08/2017 20:17:50] [Error - Spell Interface]

Cytat:
[13/08/2017 20:17:50] data/spells/scripts/sakura/pt.lua:eek:nCastSpell
[13/08/2017 20:17:50] Description:
[13/08/2017 20:17:50] (luaDoTargetCombatHealth) Creature not found
Nie jestem pewny jak to zrobi? ?eby dzia?a?o :/

<b>Wersja silnika:</b> TFS 0.3.6

Skrypt:

 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

<b>Rodzaj skryptu:</b> SPELLS
<b>Opis skryptu:</b> Skrypt ma za zadanie leczy? tylko ludzi w party, lecz nie dzia?a, wyskakuje taki b??d: [13/08/2017 20:17:50] [Error - Spell Interface]

Cytat:
[13/08/2017 20:17:50] data/spells/scripts/sakura/pt.lua:eek:nCastSpell
[13/08/2017 20:17:50] Description:
[13/08/2017 20:17:50] (luaDoTargetCombatHealth) Creature not found
Nie jestem pewny jak to zrobi? ?eby dzia?a?o :/

<b>Wersja silnika:</b> TFS 0.3.6

Skrypt:


[lua]local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)


function onGetFormulaValues(cid, level, maglevel)
min = (getPlayerMagLevel(cid) * 112) + getPlayerLevel(cid) / 115
max = (getPlayerMagLevel(cid) * 3) + getPlayerLevel(cid) / 55
return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
local pos, partymembers = getCreaturePosition(cid), getPartyMembers(cid)
if(partymembers == nil or type(partymembers) ~= 'table' or table.maxn(partymembers) <= 1) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You don't have party members!")
return false
end

local party = {}
for _, pid in ipairs(partymembers) do
if(getDistanceBetween(getCreaturePosition(pid), pos) <= 7) then
table.insert(party, pid)
end
end

for _, pid in ipairs(party) do
doCombat(cid, combat, numberToVariant(pid))
doPlayerSendTextMessage(pid, MESSAGE_INFO_DESCR, getPlayerName(cid).." has healed you!")
end

return true
end[/lua]

---------- Tre?? dodana o 13:17 ----------

1.Rodzaj skryptu-
2.Opis skryptu:War mod z blaszkami
3.Wersja silnika: tfs 0.4

https://tibia.net.pl/threads/545783-TFS-0-4-Elf-War-System-(With-Emblems)
 
Last edited:

Never Back Down

Active User
Joined
Sep 6, 2015
Messages
86
Reaction score
1
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu: xxx
Opis skryptu: System czaszek na war ots tzn ze jak masz 50 fragow dostajesz zielonego skulla i co 50 fragow kolejne skulle az do black skulla Tutaj : obrazek jakie skulle sa w tibi
Wersja silnika: tfs 0.4_svn
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu: xxx
Opis skryptu: System czaszek na war ots tzn ze jak masz 50 fragow dostajesz zielonego skulla i co 50 fragow kolejne skulle az do black skulla Tutaj : obrazek jakie skulle sa w tibi
Wersja silnika: tfs 0.4_svn

MOD
[xml]<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Skull System" version="1.0" author="Skyforever" contact="tibiaking.com" enabled="yes">
<config name="SkullC_func"><![CDATA[

function setSkullColor(cid)
local t = {
[{1,50}] = 1,
[{51,100}] = 2,
[{101,150}] = 3,
[{151,200}] = 4,
[{201,math.huge}] = 5
}
for var, ret in pairs(t) do
if getPlayerFrags(cid) >= var[1] and getPlayerFrags(cid) <= var[2] then
doCreatureSetSkullType(cid, ret)
end
end
end
function getPlayerFrags(cid)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}
local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC")
if(result:getID() ~= -1) then
repeat
local content = {date = result:getDataInt("date")}
if(content.date > times.today) then
table.insert(contents.day, content)
elseif(content.date > times.week) then
table.insert(contents.week, content)
else
table.insert(contents.month, content)
end
until not result:next()
result:free()
end
local size = {day = table.maxn(contents.day),week = table.maxn(contents.week),month = table.maxn(contents.month)}
return size.day + size.week + size.month
end
]]></config>
<event type="login" name="SkullLogin" event="script"><![CDATA[
domodlib('SkullC_func')
function onLogin(cid)
registerCreatureEvent(cid, "ColorKill")
setSkullColor(cid)
return true
end]]></event>
<event type="kill" name="ColorKill" event="script"><![CDATA[
domodlib('SkullC_func')
function onKill(cid, target)
if isPlayer(cid) and isPlayer(target) then
doCreatureSetSkullType(target, 0)
addEvent(setSkullColor, 100, cid)
end
return true
end]]></event>
</mod>[/xml]
 
Last edited:

sempele

Active User
Joined
Nov 19, 2010
Messages
107
Reaction score
3
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu:
Opis skryptu: "Task system za addony" Piszemy np. komend? !task dragon, uaktywnia nam si? task na np zabicie 500 dragon?w i w zamian dostajemy np first citizen addon. Post?p taska wy?wietlany jest na "Default" + mo?liwo?? anulowania taska
Wersja silnika :TFS 0.4
 

Never Give Up

Forum friend
Joined
Jul 7, 2010
Messages
1,552
Reaction score
69
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu : xxx
Opis skryptu :
ad367be59e3493ccb215ca7e19f8af62.gif

Wersja silnika: TFS 0.3.6
 

Czopeq

Advanced User
Joined
Jun 29, 2015
Messages
191
Reaction score
6
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu: Spell: target
Opis skryptu: Spell, kt?ry po u?yciu usuwa to co znajduje si? pod targetem(pr?cz itemu o id 1234) i stawia item o id xxxx. :D
Wersja silnika : tfs 0.3.6/0.4
 

Avemajor

Advanced User
Joined
Feb 6, 2012
Messages
346
Reaction score
12
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Wiecie mo?e dlaczego nie dzia?? mi ten skrypt na dawanie levela ?
function onUse(item, fromPosition, itemEx, toPosition)
doCreatureSay( "You Gained 1223372036854775808 Experience!", TALKTYPE_ORANGE_1)
doPlayerAddLevel(cid, 700000)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid)
return TRUE
else
doCreatureSay(cid, "Nie mozesz zazywac tego itemu", TALKTYPE_ORANGE_1)
end
end
 

James Montana

Active User
Joined
Feb 22, 2016
Messages
103
Reaction score
1
Age
26
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

1

Rodzaj skryptu: Spells
Opis skryptu: Czar kt?ry mo?na u?ywa? raz na minut?, na target, (Tylko dzia?a na graczy), po u?yciu na przeciwniku daje mu obra?enie kondycji tzn: w miejscu gdzie s? ikony w cliencie utamy haste itp pojawia si? tez jakas ikonka mo?e by? death"
A obra?enie to ma by? ze wszystkie itemy kt?re ma na sobie nie chroni? go przez 10sekund. Tak jak by ich na sobie nie mia?
Wersja silnika: 8.6


2

Rodzaj skryptu:
Opis skryptu: Runa kt?ra zmniejsza exhausted o polowe na runy/spelle na okre?lony czas 20sekund
Wersja silnika: 86

3


Rodzaj skryptu: (jak nie wiesz o co chodzi - to zostaw puste)
Opis skryptu: System target npc, dodatek do trade po zaatakowaniu Npc otwiera si? Bp z jego oferta, gdy przeniesiemy jakis item na ziemie b?d? do naszego Bp to dzia?a tak jak by?my kupili co? na trade
Wersja silnika: 8.6


By?a by mo?liwo?? wykonania takich skrypt?w? Czy potrzeba edycji w source?
Pozdrawiam pomys?odawc?w oraz realizator?w. Fajna intencja serio dawno takiego czegos nie by?o
 
Last edited:

Avari

Active User
Joined
Jun 29, 2017
Messages
55
Reaction score
2
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

@ Avemajor


[LUA]
function onUse(item, fromPosition, itemEx, toPosition)
if item.uid >= 1 then
doCreatureSay(cid, "You Gained 1223372036854775808 Experience!", TALKTYPE_ORANGE_1)
doPlayerAddLevel(cid, 700000)
doSendMagicEffect(cid, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid, 1)
return TRUE
else
doCreatureSay(cid, "Nie masz tego itemu", TALKTYPE_ORANGE_1)
end
end

[/LUA]

i do actions.xml

[XML]<action itemid="ID" event="script" value="nazwa_pliku.lua"/>[/XML]
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Wiecie mo?e dlaczego nie dzia?? mi ten skrypt na dawanie levela ?
function onUse(item, fromPosition, itemEx, toPosition)
doCreatureSay( "You Gained 1223372036854775808 Experience!", TALKTYPE_ORANGE_1)
doPlayerAddLevel(cid, 700000)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid)
return TRUE
else
doCreatureSay(cid, "Nie mozesz zazywac tego itemu", TALKTYPE_ORANGE_1)
end
end

[lua]function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, 1234) ~= -1 then
doCreatureSay(cid, "You Gained 1223372036854775808 Experience!", TALKTYPE_ORANGE_1)
doPlayerAddLevel(cid, 700000)
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid, 1)
return true
else
doCreatureSay(cid, "Nie mozesz zazywac tego itemu", TALKTYPE_ORANGE_1)
end
end[/lua]

---------- Tre?? dodana o 12:24 ----------

Rodzaj skryptu:
Opis skryptu: "Task system za addony" Piszemy np. komend? !task dragon, uaktywnia nam si? task na np zabicie 500 dragon?w i w zamian dostajemy np first citizen addon. Post?p taska wy?wietlany jest na "Default" + mo?liwo?? anulowania taska
Wersja silnika :TFS 0.4

MOD.xml
[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"><![CDATA[
onlyOneTime = true
mainStorage = 73435

task = {
['dragon'] = {storage = 5756, beginStorageValue = 1, finishStorageValue = 2, count = 500,
addons = {male = {128}, female = {136}, which = {1}}}
}

function isSummon(cid)
if(not isCreature(cid)) then
return false
end
return getCreatureMaster(cid) ~= cid
end
]]></config>

<talkaction words="!task" event="script"><![CDATA[
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"><![CDATA[
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"><![CDATA[
registerCreatureEvent(cid, 'talkactionTask')
]]></event>
</mod>[/xml]
 

Never Give Up

Forum friend
Joined
Jul 7, 2010
Messages
1,552
Reaction score
69
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu : xxx
Opis skryptu :
ad367be59e3493ccb215ca7e19f8af62.gif

Wersja silnika: TFS 0.3.6
 

James Montana

Active User
Joined
Feb 22, 2016
Messages
103
Reaction score
1
Age
26
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

1

Rodzaj skryptu: Spells
Opis skryptu: Czar kt?ry mo?na u?ywa? raz na minut?, na target, (Tylko dzia?a na graczy), po u?yciu na przeciwniku daje mu obra?enie kondycji tzn: w miejscu gdzie s? ikony w cliencie utamy haste itp pojawia si? tez jakas ikonka mo?e by? death"
A obra?enie to ma by? ze wszystkie itemy kt?re ma na sobie nie chroni? go przez 10sekund. Tak jak by ich na sobie nie mia?
Wersja silnika: 8.6
 

Monte198

User
Joined
Sep 15, 2017
Messages
12
Reaction score
0
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Rodzaj skryptu:
Opis: Vip medal. Po u?yciu dostajemy Vipa na 30 dni. Gracz vip ma zwi?kszony exp, skille oraz loot o 5% + komenda pozwalaj?cy sprawdzi? ile dni vipa nam zosta?o.
Wersja silnika: TFS 0.4
 

qwasniak

Advanced User
Joined
May 9, 2013
Messages
303
Reaction score
7
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Actions

[XML]<action itemid="5785" script="vipmedal.lua"/>[/XML]

vipmedal.lua
[LUA]function onUse(cid, item, fromPosition, itemEx, toPosition)
local cfg =
{
[5785] = {stor = (getPlayerStorageValue(cid)+30), dni = 30} -- ID, Storage.dni., dni ---Medal of Honor
}

local status = 997
local storage = getPlayerStorageValue(cid, status)
if (storage == -1) then
doSendAnimatedText(getCreaturePosition(cid), "+".. cfg[item.itemid].dni .." dni", TEXTCOLOR_LIGHTBLUE)
doSendMagicEffect(getCreaturePosition(cid), 39)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Jestes VIPEM na ".. cfg[item.itemid].dni .." dni.")
setPlayerStorageValue(cid, status, cfg[item.itemid].stor)
doRemoveItem(item.uid)
else
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Jestes juz vipem.")
end
return true
end[/LUA]

Globalevents​

[XML]<globalevent name="Vip" interval="86400000" script="vipmin.lua"/>
<globalevent name="DelVip" interval="36000000" script="vipdel.lua"/>
<globalevent name="efekty" interval="1" script="efekty.lua"/>[/XML]

vipmin.lua
[LUA]local storage = 997
function onThink(cid, item, fromPosition, toPosition)
for _, name in ipairs(getOnlinePlayers()) do
local player = getPlayerByName(name)
if getPlayerStorageValue(player, storage) > 1 then
setPlayerStorageValue(player, storage, getPlayerStorageValue(player) - 1)
end
end
end[/LUA]

vipdel.lua
[LUA]local storage = 10000
function onThink(cid, item, fromPosition, toPosition)
for _, name in ipairs(getOnlinePlayers()) do
local player = getPlayerByName(name)
if getPlayerStorageValue(player, storage) == 1 then
setPlayerStorageValue(player, storage, 0)
end
end
end[/LUA]

efekty.lua
[LUA]local exprate=
function onThink(interval, lastExecution)
for _, name in ipairs(getOnlinePlayers()) do
local cid = getPlayerByName(name)
if getPlayerStorageValue(cid, 997) >= 1 then
doPlayerSetExperienceRate(cid, exprate)
--doPlayerSetRate(cid, SKILL__AXE, value)
--doPlayerSetRate(cid, SKILL__MAGLEVEL, value)
--itd
end
end
return true
end[/LUA]
Lecz te efekty lepiej przeniesc do CreatureScripts
 

sempele

Active User
Joined
Nov 19, 2010
Messages
107
Reaction score
3
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

MOD.xml
[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 = 500,
addons = {male = {128}, female = {136}, which = {1}}}
}

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][/QUOTE]

Niby wszystko jest dobrze, ale nie da si? anulowa? taska oraz za jego wykonanie nie dostajemy addon?w
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
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.
42libm.png

[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"><![CDATA[
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"><![CDATA[
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"><![CDATA[
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"><![CDATA[
registerCreatureEvent(cid, 'talkactionTask')
]]></event>
</mod>[/xml]
 

KadreZ

Advanced User
Joined
Aug 18, 2015
Messages
443
Reaction score
6
Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Odp: Skrypty na zam?wienie (lua, php, mysql, c++ [podstawy])

Typ Skryptu :
Po kilknieciu na skrzynie ID : 1740, dostajemy ustalony reward np : 2160 count 50, oraz teleportuje nas owa skrzyna na te Koordynaty : {x = 1226, y = 1052, z = 8}
Wersja 8.60
tfs 0.4
 
Top