Gsp
RP
- Joined
- Jan 3, 2008
- Messages
- 250
- Solutions
- 1
- Reaction score
- 4
Code:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
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
selfSay('Hello ' .. getCreatureName(cid) .. '! I need some help.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'help') or msgcontains(msg, 'quest') then
if getPlayerStorageValue(cid,50088) == -1 then
selfSay('Do you want to help me?')
talk_state = 1
else
selfSay('I already gave you my Quest.')
talk_state = 0
end
elseif msgcontains(msg, 'sheet') or msgcontains(msg, 'music') then
if getPlayerStorageValue(cid,50088) == 1 then
selfSay('Do you have the music sheets?')
talk_state = 2
elseif getPlayerStorageValue(cid,50088) > 1
selfSay('You already did my quest')
talk_state = 0
end
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
selfSay('Get the 3 different music sheets from 3 different kings. They are in the human dimension.')
setPlayerStorageValue(cid,50088, 1)
talk_state = 0
else
selfSay('So shall it be chicken.')
talk_state = 0
end
elseif talk_state == 2 then
sheet1 = getPlayerItemCount(cid,6087)
sheet2 = getPlayerItemCount(cid,6088)
sheet3 = getPlayerItemCount(cid,6089)
if msgcontains(msg, 'yes') then
if sheet1 >= 1 and sheet2 >= 1 and sheet3 >=1 then
doPlayerRemoveItem (cid,6087,1)
doPlayerRemoveItem (cid,6088,1)
doPlayerRemoveItem (cid,6089,1)
doPlayerAddItem (cid,2127,1)
selfSay('Here is your reward. You have to figure the secret out yourself.')
talk_state = 0
focus = 0
else
selfSay('Fool, You dont have all the sheets! Get out of here.')
talk_state = 0
focus = 0
end
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end
Its a quest npc script you give him the sheets and he'll reward you. if someone can help i will be so happy
regards