Odp: Support Scripts - naprawiamy / tworzymy
Oskar a moze wiesz jak to zrobic http://tibia.net.pl/account-maker/465659-temple-ots-8-6-a.html
Oskar a moze wiesz jak to zrobic http://tibia.net.pl/account-maker/465659-temple-ots-8-6-a.html
local outfit =
{
-- Girls
{
lookType = 12,
lookHead = 19,
lookBody = 53,
lookLegs = 92,
lookFeet = 79,
lookAddons = 0
},
-- Boys
{
lookType = 12,
lookHead = 19,
lookBody = 79,
lookLegs = 3,
lookFeet = 81,
lookAddons = 0
}
}
local coinID = ITEM_GOLD_COIN
local wastingInterval = 1000
local wastingQuantity = 1
local triggerQuantity = 100
local warnOnLowSupply = TRUE
local lowSupplyMargin = 200
local storage = 50780
-- Config << --
local condition1 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180)
local condition2 = createConditionObject(CONDITION_HASTE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionFormula(condition2, 2.5, 0, 3.0, 0)
local area = createCombatArea({
{0, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 2, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 1, 0, 0, 0}
})
local animCombat =
{
createCombatObject(),
createCombatObject()
}
local sexyEffect =
{
CONST_ME_FIREWORK_RED,
CONST_ME_FIREWORK_YELLOW,
CONST_ME_MAGIC_RED,
CONST_ME_MAGIC_GREEN
}
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatArea(animCombat[2], area)
setCombatArea(animCombat[1], area)
local function StopSuperForm(cid)
if (getPlayerStorageValue(cid, storage) == 1) then
setPlayerStorageValue(cid, storage, 0)
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doRemoveCondition(cid, CONDITION_HASTE)
end
return TRUE
end
local function SuperForm(cid, sexIndex)
if (isCreature(cid)) then
if (getPlayerStorageValue(cid, storage) == 1) then
local goldLeft = getPlayerItemCount(cid, coinID)
if (goldLeft >= wastingQuantity) then
local position = getCreaturePosition(cid)
doPlayerRemoveItem(cid, coinID, wastingQuantity)
doSendMagicEffect(position, sexyEffect[sexIndex + 2])
doSendMagicEffect(position, sexyEffect[sexIndex])
if (goldLeft <= lowSupplyMargin and warnOnLowSupply == TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(goldLeft - wastingQuantity) .. "!")
end
addEvent(SuperForm, wastingInterval, cid, sexIndex)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!")
doPlayerRemoveItem(cid, 2127, 1)
return StopSuperForm(cid)
end
end
end
end
function onEquip(cid, item, slot)
if (getPlayerItemCount(cid, coinID) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1) then
local sexIndex = getPlayerSex(cid) + 1
doCombat(cid, animCombat[sexIndex], numberToVariant(cid))
doSetCreatureOutfit(cid, outfit[sexIndex], -1)
setPlayerStorageValue(cid, storage, 1)
doAddCondition(cid, condition1)
doAddCondition(cid, condition2)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))
doPlayerRemoveItem(cid, coinID, triggerQuantity)
SuperForm(cid, sexIndex)
elseif (getPlayerStorageValue(cid, storage) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!")
end
return TRUE
end
function onDeEquip(cid, item, slot)
return StopSuperForm(cid)
end
<movevent type="Equip" itemid="2127" slot="ring" event="script" value="chaosbangle.lua"/>
<movevent type="DeEquip" itemid="2127" slot="ring" event="script" value="chaosbangle.lua"/>
local outfit = {
{
lookType = 12,
lookHead = 19,
lookBody = 53,
lookLegs = 92,
lookFeet = 79,
lookAddons = 0
},
{
lookType = 12,
lookHead = 19,
lookBody = 79,
lookLegs = 3,
lookFeet = 81,
lookAddons = 0
}
}
local coinID = 2148
local wastingInterval = 1000
local wastingQuantity = 1
local triggerQuantity = 100
local warnOnLowSupply = TRUE
local lowSupplyMargin = 200
local storage = 50780
-- Config << --
local condition1 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180)
local condition2 = createConditionObject(CONDITION_HASTE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionFormula(condition2, 2.5, 0, 3.0, 0)
local area = createCombatArea({
{0, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 2, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 1, 0, 0, 0}
})
local animCombat = {
createCombatObject(),
createCombatObject()
}
local sexyEffect = {
CONST_ME_FIREWORK_RED,
CONST_ME_FIREWORK_YELLOW,
CONST_ME_MAGIC_RED,
CONST_ME_MAGIC_GREEN
}
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatArea(animCombat[2], area)
setCombatArea(animCombat[1], area)
local function StopSuperForm(cid)
if (getPlayerStorageValue(cid, storage) == 1) then
setPlayerStorageValue(cid, storage, 0)
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doRemoveCondition(cid, CONDITION_HASTE)
end
return TRUE
end
local function SuperForm(cid, sexIndex)
if (isCreature(cid)) then
if (getPlayerStorageValue(cid, storage) == 1) then
local goldLeft = getPlayerItemCount(cid, coinID)
if (goldLeft >= wastingQuantity) then
local position = getCreaturePosition(cid)
doPlayerRemoveItem(cid, coinID, wastingQuantity)
doSendMagicEffect(position, sexyEffect[sexIndex + 2])
doSendMagicEffect(position, sexyEffect[sexIndex])
if (goldLeft <= lowSupplyMargin and warnOnLowSupply == TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(goldLeft - wastingQuantity) .. "!")
end
addEvent(SuperForm, wastingInterval, cid, sexIndex)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!")
doPlayerRemoveItem(cid, 2127, 1)
return StopSuperForm(cid)
end
end
end
end
function onEquip(cid, item, slot)
if (getPlayerItemCount(cid, coinID) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1 and getPlayerSex(cid) < 2) then
local sexIndex = getPlayerSex(cid) + 1
doCombat(cid, animCombat[sexIndex], numberToVariant(cid))
doSetCreatureOutfit(cid, outfit[sexIndex], -1)
setPlayerStorageValue(cid, storage, 1)
doAddCondition(cid, condition1)
doAddCondition(cid, condition2)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))
doPlayerRemoveItem(cid, coinID, triggerQuantity)
SuperForm(cid, sexIndex)
elseif (getPlayerStorageValue(cid, storage) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!")
end
return TRUE
end
function onDeEquip(cid, item, slot)
return StopSuperForm(cid)
end
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos, item, itemEx)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function getPokemonMaxLife(name)
local file = io.open('data/monster/monsters.xml','r')
local arquivo = file:read(-1):lower():match('<monster name="'..name:lower()..'" file="(.-)"/>')
file:close()
local data = io.open('data/monster/'..(arquivo or ''),'r')
if not data then
return 100
end
local maximo = data:read(-1):match('max%s*=%s*"(%d+)"')
data:close()
return maximo
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi')) and getDistanceToCreature(cid) < 4 then
if getPlayerStorageValue(cid, 25000) == 5 then
return selfSay('Voc? est? montando.')
end
if getPlayerStorageValue(cid, 23000) == 5 then
return selfSay('Twoj pokemon musi byc zchowany.')
end
if #getCreatureSummons(cid) >= 1 then
selfSay('Zsiadaj z niego.')
focus = 0
talk_start = 0
return TRUE
end
local idballs = {
[2532] = {2531},
[2653] = {2557},
[2654] = {2525},
[2652] = {2524},
[2195] = {2523},
[2531] = {2532},
[2557] = {2653},
[2525] = {2654},
[2524] = {2652},
[2523] = {2195},
}
local balls = idballs[getPlayerSlotItem(cid,8).itemid]
if balls == nil then
return selfSay('chowaj GO!')
end
local nome = getItemAttribute(getPlayerSlotItem(cid,8).uid,"name")
local poke_name1 = nome:match('(.-) Pokeball')
local poke_name2 = nome:match('(.-) Superball')
local poke_name3 = nome:match('(.-) Ultraball')
local poke_name4 = nome:match('(.-) Greatball')
local poke_name5 = nome:match('(.-) Masterball')
if poke_name1 == nil and poke_name2 == nil and poke_name3 == nil and poke_name4 == nil and poke_name5 == nil then
return doPlayerSendCancel(cid,"coloque no lugar correto")
end
if poke_name1 ~= nil then
poke_name = poke_name1
elseif poke_name2 ~= nil then
poke_name = poke_name2
elseif poke_name3 ~= nil then
poke_name = poke_name3
elseif poke_name4 ~= nil then
poke_name = poke_name4
elseif poke_name5 ~= nil then
poke_name = poke_name5
end
doItemSetAttribute(getPlayerSlotItem(cid,8).uid, "aid", getPokemonMaxLife(poke_name))
selfSay("Lecisz z tym koksem!")
doTransformItem(getPlayerSlotItem(cid, 8).uid, balls[1])
local hp = getCreatureMaxHealth(cid)
doCreatureAddHealth(cid, hp)
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
local config = {
ile_dodaje_hp = 500,
o_ile_procent_zwieksza_obrazenia = 110,
ile_bierze_many = 10,
co_ile_sec = 1,
efekt_podczas_zmiany = CONST_ME_HOLYAREA
}
local storage_obrazen = 4135
function onSay(cid, words, param)
if param == "" then
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + config.ile_dodaje_hp)
doPlayerSetStorageValue(cid, storage_obrazen, config.o_ile_procent_zwieksza_obrazenia)
doSendMagicEffect(getCreaturePosition(cid), config.efekt_podczas_zmiany)
doCreatureAddMana(cid, -config.ile_bierze_many, false)
addEvent(mana_gain, config.co_ile_sec * 1000, {cid = cid})
end
return true
end
function mana_gain(p)
if isPlayer(p.cid) then
if getCreatureMana(p.cid) >= config.ile_bierze_many then
doCreatureAddMana(p.cid, -config.ile_bierze_many, false)
addEvent(mana_gain, config.co_ile_sec * 1000, p)
else
doPlayerSetStorageValue(p.cid, storage_obrazen, 0)
setCreatureMaxHealth(p.cid, getCreatureMaxHealth(p.cid) - config.ile_dodaje_hp)
doCreatureAddHealth(p.cid, 1)
end
end
return true
end
local szansa = {
['abra'] = 15,
['shiny abra'] = 15,
}
local ID_GREATBALL = 2146
local ID_SUPERBALL = 2147
local ID_ULTRABALL = 2150
local ID_MASTERBALL = 2554
local ID_LAPIE = 24
local ID_NIE_LAPIE = 23
local pokebolas = {
[2149] = {2532,"Pokeball"},
[2147] = {2653,"Superball"},
[2146] = {2652,"Greatball"},
[2150] = {2654,"Ultraball"},
[2521] = {2195,"Masterball"},
}
local level = {
['abra'] = 30,
['shiny abra'] = 30,
}
local function lapie(params)
doSendMagicEffect(getCreaturePosition(params.cid), 173)
doPlayerSendTextMessage(params.cid, 25, 'Zlapales Pokemona! ('..params.monster..').')
item = doCreateItemEx(params.ball)
doItemSetAttribute(item, "name", ""..params.monster.." "..params.ball2)
doItemSetAttribute(item, "level", params.level)
doItemSetAttribute(item, "aid", params.hp)
doPlayerAddItemEx(params.cid, item, true)
end
local function nielapie(params)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local monster = getItemName(itemEx.uid):match("dead (.*)")
if item.itemid == ID_GREATBALL then
szansas = (szansa[monster]) * 2
elseif item.itemid == ID_SUPERBALL then
szansas = (szansa[monster]) * 3
elseif item.itemid == ID_ULTRABALL then
szansas = (szansa[monster]) * 4
elseif item.itemid == 2521 then
szansas = (szansa[monster]) * 400
else
szansas = szansae[monster]
end
if not szansa[monster] then
return doPlayerSendTextMessage(cid, 23, 'Nie udalo ci sie zlapac Pokemona!')
end
if math.random(1,1000) <= szansas then
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 24)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 202)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 198)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 200)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 24)
end
local hpmax = 1
local ball = pokebolas[item.itemid]
addEvent(lapie, 4000, {cid = cid, monster = monster, ball = ball[1], ball2 = ball[2], level = level[monster], hp = hpmax})
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
else
if item.itemid == 2149 then
doSendMagicEffect(toPosition, 23)
elseif item.itemid == 2147 then
doSendMagicEffect(toPosition, 201)
elseif item.itemid == 2146 then
doSendMagicEffect(toPosition, 197)
elseif item.itemid == 2150 then
doSendMagicEffect(toPosition, 199)
elseif item.itemid == 2521 then
doSendMagicEffect(toPosition, 23)
end
doRemoveItem(itemEx.uid, 1)
doRemoveItem(item.uid, 1)
end
return TRUE
end
function onSay(cid, words, param)
if param == "" then
x = 'Najlepsi mordercy:\n'
local frags, names = {}, {}
for i = 1, 250 do
row = db.getResult('SELECT `frags`, `name` FROM `players` WHERE `id` = '..i..';')
local frag, name = row:getDataInt('frags'), row:getDataString('name')
table.insert(frags, frag)
table.insert(names, name)
end
table.sort(frags)
if #frags > 15 then
for v = #frags - 15, 1, -1 do
table.remove(frags, v)
end
end
for k = #frags, 1, -1 do
x = x .. names[k] .. ' - ' .. frags[k] .. '\n'
end
doShowTextDialog(cid, 5669, x)
end
return true
end
local config = {
vocs = {8, 9, 10, 11},
ile_dodaje_hp = 500,
o_ile_procent_zwieksza_obrazenia = 110,
ile_bierze_many = 10,
co_ile_sec = 1,
efekt_podczas_zmiany = CONST_ME_HOLYAREA
}
local storage_obrazen = 4135
function onSay(cid, words, param)
if param == "" then
for i = 1, #config.vocs do
if getPlayerVocation(cid) == i then
doPlayerSetVocation(cid, config.vocs[i])
end
end
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + config.ile_dodaje_hp)
doPlayerSetStorageValue(cid, storage_obrazen, config.o_ile_procent_zwieksza_obrazenia)
doSendMagicEffect(getCreaturePosition(cid), config.efekt_podczas_zmiany)
doCreatureAddMana(cid, -config.ile_bierze_many, false)
addEvent(mana_gain, config.co_ile_sec * 1000, {cid = cid})
end
return true
end
function mana_gain(p)
if isPlayer(p.cid) then
if getCreatureMana(p.cid) >= config.ile_bierze_many then
doCreatureAddMana(p.cid, -config.ile_bierze_many, false)
addEvent(mana_gain, config.co_ile_sec * 1000, p)
else
doPlayerSetStorageValue(p.cid, storage_obrazen, 0)
setCreatureMaxHealth(p.cid, getCreatureMaxHealth(p.cid) - config.ile_dodaje_hp)
doCreatureAddHealth(p.cid, 1)
end
end
return true
end
local config = {
advancedFragList = getBooleanFromString(getConfigValue("advancedFragList"))
}
function onSay(cid, words, param, channel)
local time = os.time()
local times = {today = (time - 86400), week = (time - (7 * 86400))}
local contents = {day = {}, week = {}, month = {}}
local result = 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 = {
name = result:getDataString("name"),
level = result:getDataInt("level"),
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)
}
if(config.advancedFragList) then
local result = "Frags gained today: " .. size.day .. "."
if(size.day > 0) then
for _, content in ipairs(contents.day) do
result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
end
result = result .. "\n"
end
result = result .. "\nFrags gained this week: " .. (size.day + size.week) .. "."
if(size.week > 0) then
for _, content in ipairs(contents.week) do
result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
end
result = result .. "\n"
end
result = result .. "\nFrags gained this month: " .. (size.day + size.week + size.month) .. "."
if(size.month > 0) then
for _, content in ipairs(contents.month) do
result = result .. "\n* " .. os.date("%d %B %Y %X at ", content.date) .. content.name .. " on level " .. content.level
end
result = result .. "\n"
end
local skullEnd = getPlayerSkullEnd(cid)
if(skullEnd > 0) then
result = result .. "\nYour " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd)
end
doPlayerPopupFYI(cid, result)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You currently have " .. size.day .. " frags today, " .. (size.day + size.week) .. " this week and " .. (size.day + size.week + size.month) .. " this month.")
if(size.day > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Last frag at " .. os.date("%d %B %Y %X", contents.day[1].date) .. " on level " .. contents.day[1].level .. " (" .. contents.day[1].name .. ").")
end
local skullEnd = getPlayerSkullEnd(cid)
if(skullEnd > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your " .. (getCreatureSkullType(cid) == SKULL_RED and "red" or "black") .. " skull will expire at " .. os.date("%d %B %Y %X", skullEnd))
end
end
return true
end
doRemoveItem(item.uid)
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Dowidzenia.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not
string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if ((string.find(msg, '(%a*)hi(%a*)')
or string.find(msg, '(%a*)siema(%a*)')
or string.find(msg, '(%a*)czesc(%a*)')
or string.find(msg, '(%a*)cze(%a*)')
or string.find(msg, '(%a*)yo(%a*)')
or string.find(msg, '(%a*)elo(%a*)'))
and (focus == 0)) and getDistanceToCreature(cid) < 4 then
rsay = math.random(1,4)
if rsay == 1 then says = 'Waazzuup'
elseif rsay == 2 then says = 'Siema'
elseif rsay == 3 then says = 'Czesc'
elseif rsay == 4 then says = 'Witam'
end
selfSay('Siemanko ' .. creatureGetName(cid) .. '! Jezeli jestes zainteresowany kupnem pacc wejdz na stronke mazurek.no-ip.biz po lewej stronie masz Premium Accont.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('' .. creatureGetName(cid) .. '! Jezeli jestes zainteresowany kupnem pacc wejdz na stronke mazurek.no-ip.biz po lewej stronie masz Premium Accon') elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'promotion') or msgcontains(msg, 'promote') then
if isPromoted(cid) then
selfSay('Juz masz Promotion.')
talk_state = 0
elseif getPlayerLevel(creatureGetName(cid)) < 10 then
selfSay('Wybacz potrzeba ci 10 poziom !')
talk_state = 0
elseif not isPremium(cid) then
selfSay('Wybacz, ale najpierw kup Premium Accont!')
talk_state = 0
else
selfSay('Czy chcesz kupic Promotion za 1 k?')
talk_state = 1
end
elseif msgcontains(msg, 'p4323424u3m') then
selfSay('Do you want to buy 10 premmy hours for 10k?')
talk_state = 2
elseif talk_state == 1 then
if msgcontains(msg, 'yes') or msgcontains(msg, 'tak') then
if pay(cid,1000) then
selfSay('/promote ' .. creatureGetName(cid))
selfSay('Dostales Promotion!')
else
selfSay('Wybacz, ale masz za malo pieniedzy.')
end
end
talk_state = 0
elseif talk_state == 2 then
if msgcontains(msg, '3wdf645d3s') then
if pay(cid,10000) then
selfSay('/premmy 10 ' .. creatureGetName(cid))
selfSay('You have 10 premmy hours more!')
else
selfSay('Sorry, you do not have enough money.')
end
end
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Narazie ' .. creatureGetName(cid) .. ' . Tylko kup pacc to nam pomoze !')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Nastepny prosze.')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Kupujac Pacc wspomagasz Tego OTS!')
focus = 0
end
end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,20)
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
end
Notka moderatorska: |
W g??wnym po?cie wyra?nie widnieje:
|
local outfit = {
{
lookType = 12,
lookHead = 19,
lookBody = 53,
lookLegs = 92,
lookFeet = 79,
lookAddons = 0
},
{
lookType = 12,
lookHead = 19,
lookBody = 79,
lookLegs = 3,
lookFeet = 81,
lookAddons = 0
}
}
local coinID = 2148
local wastingInterval = 1000
local wastingQuantity = 1
local triggerQuantity = 100
local warnOnLowSupply = TRUE
local lowSupplyMargin = 200
local storage = 50780
-- Config << --
local condition1 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180)
local condition2 = createConditionObject(CONDITION_HASTE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionFormula(condition2, 2.5, 0, 3.0, 0)
local area = createCombatArea({
{0, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 2, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 1, 0, 0, 0}
})
local animCombat = {
createCombatObject(),
createCombatObject()
}
local sexyEffect = {
CONST_ME_FIREWORK_RED,
CONST_ME_FIREWORK_YELLOW,
CONST_ME_MAGIC_RED,
CONST_ME_MAGIC_GREEN
}
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatArea(animCombat[2], area)
setCombatArea(animCombat[1], area)
local function StopSuperForm(cid)
if (getPlayerStorageValue(cid, storage) == 1) then
setPlayerStorageValue(cid, storage, 0)
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doRemoveCondition(cid, CONDITION_HASTE)
end
return TRUE
end
local function SuperForm(cid, sexIndex)
if (isCreature(cid)) then
if (getPlayerStorageValue(cid, storage) == 1) then
local goldLeft = getPlayerItemCount(cid, coinID)
if (goldLeft >= wastingQuantity) then
local position = getCreaturePosition(cid)
doPlayerRemoveItem(cid, coinID, wastingQuantity)
doSendMagicEffect(position, sexyEffect[sexIndex + 2])
doSendMagicEffect(position, sexyEffect[sexIndex])
if (goldLeft <= lowSupplyMargin and warnOnLowSupply == TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(goldLeft - wastingQuantity) .. "!")
end
addEvent(SuperForm, wastingInterval, cid, sexIndex)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!")
doPlayerRemoveItem(cid, 2127, 1)
return StopSuperForm(cid)
end
end
end
end
function onEquip(cid, item, slot)
if (getPlayerItemCount(cid, coinID) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1 and getPlayerSex(cid) < 2) then
local sexIndex = getPlayerSex(cid) + 1
doCombat(cid, animCombat[sexIndex], numberToVariant(cid))
doSetCreatureOutfit(cid, outfit[sexIndex], -1)
setPlayerStorageValue(cid, storage, 1)
doAddCondition(cid, condition1)
doAddCondition(cid, condition2)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doPlayerAddMana(cid, getPlayerMaxMana(cid) - getPlayerMana(cid))
doPlayerRemoveItem(cid, coinID, triggerQuantity)
SuperForm(cid, sexIndex)
elseif (getPlayerStorageValue(cid, storage) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!")
end
return TRUE
end
function onDeEquip(cid, item, slot)
return StopSuperForm(cid)
end
local outfit = {
{
lookType = 12,
lookHead = 19,
lookBody = 53,
lookLegs = 92,
lookFeet = 79,
lookAddons = 0
},
{
lookType = 12,
lookHead = 19,
lookBody = 79,
lookLegs = 3,
lookFeet = 81,
lookAddons = 0
}
}
local wastingInterval = 1000
local wastingQuantity = 1
local triggerQuantity = 100
local warnOnLowSupply = true
local lowSupplyMargin = 200
local storage = 50780
-- Config << --
local condition1 = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition1, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FIST, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_CLUB, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SWORD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_AXE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_DISTANCE, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_SHIELD, 120)
setConditionParam(condition1, CONDITION_PARAM_SKILL_FISHING, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAGICPOINTS, 120)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXHITPOINTSPERCENT, 180)
setConditionParam(condition1, CONDITION_PARAM_STAT_MAXMANAPOINTSPERCENT, 180)
local condition2 = createConditionObject(CONDITION_HASTE)
setConditionParam(condition2, CONDITION_PARAM_TICKS, -1)
setConditionFormula(condition2, 2.5, 0, 3.0, 0)
local area = createCombatArea({
{0, 0, 0, 1, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 0, 0, 0, 0},
{1, 0, 0, 2, 0, 0, 1},
{0, 0, 0, 0, 0, 0, 0},
{0, 1, 0, 0, 0, 1, 0},
{0, 0, 0, 1, 0, 0, 0}
})
local animCombat = {
createCombatObject(),
createCombatObject()
}
local sexyEffect = {
CONST_ME_FIREWORK_RED,
CONST_ME_FIREWORK_YELLOW,
CONST_ME_MAGIC_RED,
CONST_ME_MAGIC_GREEN
}
setCombatParam(animCombat[2], COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
setCombatParam(animCombat[2], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
setCombatParam(animCombat[1], COMBAT_PARAM_EFFECT, CONST_ME_FIREWORK_RED)
setCombatParam(animCombat[1], COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_FIRE)
setCombatArea(animCombat[2], area)
setCombatArea(animCombat[1], area)
function onEquip(cid, item, slot)
if (getPlayerMoney(cid) > triggerQuantity and getPlayerStorageValue(cid, storage) ~= 1 and getPlayerSex(cid) < 2) then
local sexIndex = getPlayerSex(cid) + 1
doCombat(cid, animCombat[sexIndex], numberToVariant(cid))
doSetCreatureOutfit(cid, outfit[sexIndex], -1)
doPlayerSetStorageValue(cid, storage, 1)
doAddCondition(cid, condition1)
doAddCondition(cid, condition2)
doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid))
doCreatureAddMana(cid, getCreatureMaxMana(cid) - getCreatureMana(cid))
doPlayerRemoveMoney(cid, triggerQuantity)
SuperForm(cid, sexIndex)
elseif (getPlayerStorageValue(cid, storage) == 1) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You cannot equip this now!")
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You do not have enough coins!")
end
return true
end
function onDeEquip(cid, item, slot)
return StopSuperForm(cid)
end
function SuperForm(cid, sexIndex)
if (isPlayer(cid)) then
if (getPlayerStorageValue(cid, storage) == 1) then
if (getPlayerMoney(cid) >= wastingQuantity) then
local position = getCreaturePosition(cid)
doPlayerRemoveMoney(cid, wastingQuantity)
doSendMagicEffect(position, sexyEffect[sexIndex + 2])
doSendMagicEffect(position, sexyEffect[sexIndex])
if (getPlayerMoney(cid) <= lowSupplyMargin and warnOnLowSupply == true) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Coins left: " ..(getPlayerMoney(cid) - wastingQuantity) .. "!")
end
addEvent(SuperForm, wastingInterval, cid, sexIndex)
else
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "Your bangle has been destroyed!")
doPlayerRemoveItem(cid, 2127, 1)
return StopSuperForm(cid)
end
end
end
return true
end
function StopSuperForm(cid)
if (getPlayerStorageValue(cid, storage) == 1) then
doPlayerSetStorageValue(cid, storage, 0)
doRemoveCondition(cid, CONDITION_OUTFIT)
doRemoveCondition(cid, CONDITION_ATTRIBUTES)
doRemoveCondition(cid, CONDITION_HASTE)
end
return true
end
-- ### CONFIG ###
-- message send to player by script "type" (types you can check in "global.lua")
SHOP_MSG_TYPE = 19
-- time (in seconds) between connections to SQL database by shop script
SQL_interval = 30
-- ### END OF CONFIG ###
function onThink(interval, lastExecution)
local result_plr = db.getResult("SELECT * FROM z_ots_comunication WHERE `type` = 'login';")
if(result_plr:getID() ~= -1) then
while(true) do
id = tonumber(result_plr:getDataInt("id"))
action = tostring(result_plr:getDataString("action"))
delete = tonumber(result_plr:getDataInt("delete_it"))
cid = getCreatureByName(tostring(result_plr:getDataString("name")))
if isPlayer(cid) == TRUE then
local itemtogive_id = tonumber(result_plr:getDataInt("param1"))
local itemtogive_count = tonumber(result_plr:getDataInt("param2"))
local container_id = tonumber(result_plr:getDataInt("param3"))
local container_count = tonumber(result_plr:getDataInt("param4"))
local add_item_type = tostring(result_plr:getDataString("param5"))
local add_item_name = tostring(result_plr:getDataString("param6"))
local received_item = 0
local full_weight = 0
if add_item_type == 'container' then
full_weight = getItemWeightById(itemtogive_id, 1)
end
local free_cap = getPlayerFreeCap(cid)
if full_weight <= free_cap then
if add_item_type == 'container' then
local new_container = doCreateItemEx(container_id, 1)
local iter = 0
while iter ~= container_count do
doAddContainerItem(new_container, itemtogive_id, itemtogive_count)
iter = iter + 1
end
received_item = doPlayerAddItemEx(cid, new_container)
else
local new_item = doCreateItemEx(itemtogive_id, itemtogive_count)
received_item = doPlayerAddItemEx(cid, new_item)
end
if received_item == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, 'You just got a >> '.. add_item_name ..' << from the [url=http://www.Havoc-Online.net]Homepage - Havoc-Online[/url] Shop Offert. Please logout so your character can save.')
db.executeQuery("DELETE FROM `z_ots_comunication` WHERE `id` = " .. id .. ";")
db.executeQuery("UPDATE `z_shop_history_item` SET `trans_state`='realized', `trans_real`=" .. os.time() .. " WHERE id = " .. id .. ";")
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. An error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
end
else
doPlayerSendTextMessage(cid, SHOP_MSG_TYPE, '>> The item '.. add_item_name ..' << that you just bought on the website couldnt be added. An error has ocurred, please wait '.. SQL_interval ..' seconds.. Shop ID: '.. id ..'')
end
end
if not(result_plr:next()) then
break
end
end
result_plr:free()
end
return TRUE
end
Masz wystarczaj?co du?o capa?
Skrypt jest dobrze napisany. Po prostu jakim? sposobem nie mo?e doda? graczowi itemka. A gdyby? zamieni? wszystkie doPlayerAddItemEx na doPlayerAddItem? Je?li to nie zadzia?a to pobieranie itemk?w ?le funkcjonuje, a w tym Ci nie pomog?. Nie szkoli?em si? w sql.
punkty1 = 0
punkty2 = 0
pilkapos = {x=95,y=117,z=7}
function onAddItem(moveitem, tileitem, position, cid)
if (moveitem.itemid == 2109 and tileitem.actionid == 1245) then
punkty1 = punkty1 + 1
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE , "Red Team - "..punkty1)
elseif (moveitem.itemid == 2109 and tileitem.actionid == 1246) then
punkty2 = punkty2 + 1
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Blue Team - "..punkty2)
end
doCreatureSay(cid,"Goool!",1)
return true
end
punkty1 = 0
punkty2 = 0
pilkapos = {x=1913,y=1156,z=7}
function onAddItem(moveItem, tileItem, position, cid)
if moveItem.itemid == 2109 and isPlayer(cid) and isInArray({1245,1246}, getThingFromPos(position).actionid) then
if getThingFromPos(position).actionid == 1245 then
punkty1 = punkty1 + 1
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE , 'Red Team - '..punkty1)
elseif getThingFromPos(position).actionid == 1246 then
punkty2 = punkty2 + 1
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'Blue Team - '..punkty2)
end
doCreatureSay(cid, 'Goool!', 1)
doRemoveItem(moveItem.uid, 1)
doCreateItem(2109, pilkapos)
end
return true
end