Help! with a script of santa xml that you of experience this is my script is The Forgotten Server, version 0.3.1 (Crying Damson) 8.40
Lua:
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 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 focus == 0) and getDistanceToCreature(cid) < 4 then
if getPlayerStorageValue(cid, 8001) == 5 then
return selfSay('Você ja recebeu seu presente.')
end
setPlayerStorageValue(cid,8001,7)
selfSay('Você deseja receber seu presente?')
focus = cid
talk_start = os.clock()
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid, 8001) == 2 then
return selfSay('Você ja recebeu seu presente!!.')
end
if getPlayerStorageValue(cid, 8001) == 7 then
return selfSay('Para receber seu presente você precisa terminar a quest!!.')
end
doPlayerAddExp(cid, 15330000) -- 15330000 é a experience que o player irá ganhar!
selfSay('Você foi presentiado com experience!!.')
setPlayerStorageValue(cid,8001,2)
setPlayerStorageValue(cid,8001,5)
focus = 0
talk_start = 0
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Tchau!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Bye.')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Bye.')
focus = 0
end
end
end
Last edited by a moderator: