function doPlayerEndTraining(cid)
if isPlayerTraining(cid) == TRUE then
doTeleportThing(cid, TRAIN_EXIT_POS, FALSE)
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
if getPlayerStorageValue(cid, STORAGEVALUE_TRAIN_CODE) > 1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Nie przepisales kodu.')
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'To koniec twojego treningu.')
end
setPlayerStorageValue(cid, STORAGEVALUE_TRAINING, 0)
setPlayerStorageValue(cid, STORAGEVALUE_TRAIN_CODE, 0)
end
end
Spacje nie s? wa?ne, tabulatory te? nie - u?atwiaj? po prostu czytanie kodu. Musisz zna? funkcje i je wpisywa? - wtedy co? si? dzieje. Nast?pnie mo?esz u?y? wyra?e? regularnych IF(czyli je?li co? jest czym? to), i tak dalej... ; ) Poszukaj poradnika napisanego przez Rahima, tam s? zaawansowane rzeczy, a spis funkcji lua tutaj:Hmmm ja mam do was pytanie chcialbym nauczyc pisac sie skryptow czy jest na to jakis program czy musze pisac wszystko sam ?
np to ...
skad mam wiedziec ile spacji i wgl tak nie skryptowalem jedynie skrypty poprawialem mozna o pomoc proscicCode:function doPlayerEndTraining(cid) if isPlayerTraining(cid) == TRUE then doTeleportThing(cid, TRAIN_EXIT_POS, FALSE) doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) if getPlayerStorageValue(cid, STORAGEVALUE_TRAIN_CODE) > 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'Nie przepisales kodu.') else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, 'To koniec twojego treningu.') end setPlayerStorageValue(cid, STORAGEVALUE_TRAINING, 0) setPlayerStorageValue(cid, STORAGEVALUE_TRAIN_CODE, 0) end end
Za proste pytania dostajecie, teraz ja zadam co? naprawd? trudnego. Czy da si? zrobi? tak aby NPC SAM zaczyna? rozmow? po tym jak gracz znajdzie si? 2 kratki od niego b?d? te? jak wejdzie na kratk? na pozycjach xxxxx
DoplayerFYI(cid,"aaaaaaaaaaaaaaaa/naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/naaaaaaaaaaaaaaaaaaaa/naaaaaaaaaaaaaaaaaaaaaaaaaaaaa/naaaaaaaaaaaaaaaaaaaaa/naaaaaaaaa/naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/naaaaaa/naaaaaaaaa/naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/naaaaaaaaaaa")
DoplayerFYI(cid,"aaaaaaaaaaaaaaaa/naaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaa/na
aaaaaaaaaaaaaaaaaaa/naaaaaaaaaa
aaaaaaaaaaaaaaaaaaa/naaaaaaaaaa
aaaaaaaaaaa/naaaaaaaaa/naaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaa/naaa
aaa/naaaaaaaaa/naaaaaa
aaaaaaaa
aaaaaa
aaaaaaaaaaa/naa
aaaaaa
aaa")
function onSay(cid, words, param)
local count = getPlayerInstantSpellCount(cid)
local text = ""
local t = {}
for i = 0, count - 1 do
local spell = getPlayerInstantSpellInfo(cid, i)
if spell.level ~= 0 then
if spell.manapercent > 0 then
spell.mana = spell.manapercent .. "%"
end
table.insert(t, spell)
end
end
table.sort(t, function(a, b) return a.level < b.level end)
local prevLevel = -1
for i, spell in ipairs(t) do
local line = ""
if prevLevel ~= spell.level then
if i ~= 1 then
line = "\n"
end
line = line .. "Spells for Level " .. spell.level .. "\n"
prevLevel = spell.level
end
text = text .. line .. " " .. spell.words .. " - " .. spell.name .. " : " .. spell.mana .. "\n"
end
doShowTextDialog(cid, 2175, text)
return TRUE
end
Notka moderatorska: |
To support w pisaniu skrypt?w do open tibia... |
Moge Ci sprawdzic, ale nie do konca wiem o co Ci chodzi. Wytlumacz mi to jasniej.jak ktos chce moge wrzucic scrypty i jakby mogl ktos mi to sprawdzic o co chodzi co i jak to bylbym wdzieczny..
local itemWindow = {
{id=2160, subType=0, buy=10000, sell=-1, recepta=4555,name="receptura elikiru magii"},
{id=2152, subType=0, buy=100, sell=100, recepta=4555,name="Test2"},
{id=2148, subType=0, buy=1, sell=1, recepta=4555,name="Test3"},
{id=2173, subType=0, buy=10000, sell=5000, recepta=4555,name="Test4"}
}
local items = {}
for _, item in ipairs(itemWindow) do
items[item.id] = {buyPrice = item.buy, sellPrice = item.sell, subType = item.subType, realName = item.name, recepta = item.recepta}
end
local function getPlayerMoney(cid)
return ((getPlayerItemCount(cid, 2160) * 10000) +
(getPlayerItemCount(cid, 2152) * 100) +
getPlayerItemCount(cid, 2148))
end
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if(items[item] == nil) then
selfSay("Ehm.. sorry... this shouldn't be there, I'm not selling it.", cid)
return
end
if(getPlayerMoney(cid) >= amount * items[item].buyPrice) then
local itemz, i = doNpcSellItem(cid, item, amount, subType, ignoreCap, inBackpacks)
if(i < amount) then
if(i == 0) then
selfSay("Sorry, but you don't have space to take it.", cid)
else
selfSay("I've sold some for you, but it seems you can't carry more than this. I won't take more money than necessary.", cid)
doPlayerRemoveMoney(cid, i * items[item].buyPrice)
end
else
local itemWindow = {
{id=2160, subType=0, buy=10000, sell=-1, recepta=4555,name="klucz1"},
{id=2160, subType=0, buy=100, sell=100, recepta=4525,name="klucz2"},
{id=2160, subType=0, buy=1, sell=1, recepta=4555,name="Test3"},
{id=2160, subType=0, buy=10000, sell=5000, recepta=4555,name="Test4"}
}
doRemoveItem(cid,items[item].id)
selfSay("Thanks for the money!", cid)
doPlayerRemoveMoney(cid, amount * items[item].buyPrice)
end
else
selfSay("Stfu noob, you don't have money.", cid)
end
end
local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if(items[item] == nil) then
selfSay("Ehm.. sorry... this shouldn't be there, I'm not buying it.", cid)
end
if(subType < 1) then
subType = -1
end
if(doPlayerRemoveItem(cid, item, amount, subType)) then
doPlayerAddMoney(cid, items[item].sellPrice * amount)
selfSay("Here you are.", cid)
else
selfSay("No item, no deal.", cid)
end
end
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_GREEN)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
function onCastSpell(cid, var)
local mana = math.random(getPlayerLevel(cid) * 4.0 + getPlayerMagLevel(cid) * 16.5,getPlayerLevel(cid) * 4.2 + getPlayerMagLevel(cid) * 18.0)
local kolor = 35 -- kolor napisu
doPlayerAddMana(cid, mana)
doSendAnimatedText(getPlayerPosition(cid),mana,kolor)
doCombat(cid, combat, var)
end
local transform =
{
--[voc_id_before_trans] = {voc_id_after_trans, addedhealth, addedmana, outfit, required_level, required_mana}
}
local texts =
{
level = "You don\'t have enough level.",
mana = "You don\'t have enough mana.",
transform = "You transform to "
}
function onSay(cid, param, words)
local Player = transform[getPlayerVocation(cid)]
if (Player == nil) then
return true
end
if (getPlayerLevel(cid) < Player[5]) then
doPlayerSendTextMessage(cid, 22, texts.level)
return true
end
if (getCreatureMana(cid) < Player[6]) then
doPlayerSendTextMessage(cid, 22, texts.mana)
return true
end
doPlayerSetVocation(cid, Player[1])
doCreatureAddMana(cid, -Player[6])
doSetCreatureOutfit(cid, Player[4], -1)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + Player[2])
setCreatureMaxMana(cid, getCreatureMaxMana(cid) + Player[3])
doPlayerSendTextMessage(cid, 22, ""..texts.transform..""..getVocationInfo(Player[1]).name..".")
return true
end
To m?wi samo przez si?, brak kolumny w players.[24/06/2010 08:40:11] mysql_real_query(): SELECT `auction_balance` FROM `players` WHERE `id` = 4; - MYSQL ERROR: Unknown column 'auction_balance' in 'field list' (1054)