Winnerandy
Experienced Web Design'er
Nice Tutorial! 

Im newbie to OT and now learning LUA.
Im reading this tutorial which was made in 12th August 2008, 17:55 so its a bit outdated and asking mod's to change things what is see has been changed since then.
there was for action scripts:
now are:Code:function onUse(cid, item, frompos, item2, topos)
Code:function onUse(cid, item, fromPosition, itemEx, toPosition)
for Talk action scripts was:
now are:Code:function onSay(cid, words, param)
Code:onSay(cid, words, param, channel)
im just learning, but in case someone else find this tutorial useful and dont get in wrong.
//Very useful tut.
local config = {
exp = 30000,
voc = {1,2,5,6},
level = 100,
words = "Exp!",
itemID = 6119
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerVocation(cid) == config.voc then
if getPlayerLevel(cid) <= config.level then
doPlayerAddExp(cid, config.exp)
doCreatureSay(cid, config.words, 18)
doRemoveItem(cid, config.itemID, 1)
doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_YELLOW)
else
doPlayerSendCancel(cid, "Sorry, you need to be lower than level "..config.level..".")
end
else
doPlayerSendCancel(cid, "Only mages can use this scroll.")
end
return TRUE
end
local config = {
exp = 10000,
voc = {1, 2, 5, 6},
level = 100,
words = "Exp!"
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(config.voc, getPlayerVocation(cid)) == TRUE then
if getPlayerLevel(cid) >= config.level then
doPlayerAddExp(cid, config.exp)
doCreatureSay(cid, config.words, TALKTYPE_YELL)
doRemoveItem(item.uid)
else
doPlayerSendCancel(cid, "Sorry, you need to be higher than level " .. config.level .. ".")
end
else
doPlayerSendCancel(cid, "Only mages can use this scroll.")
end
return TRUE
end
Thanks, helped me ;D
instead of
PHP:function onStepIn(cid, item, position, fromPosition) if item.uid == 1234 and getPlayerGroupId(cid) ~= 3 then setPlayerGroupId(cid, 3) end end ;)[/QUOTE] Why at the beginning of the script set item.uid since reading it in the xml file?