DragonBallPower
Active User
- Joined
- Nov 19, 2010
- Messages
- 92
- Reaction score
- 2
Witam.
Mam problem ot?? gdy chce zrobi? scrypt teleportacji
chce ?eby by? wyb?r do starego i nowego miejsca(questa)
niestety gdy wpisuje scrypt (podany ni?ej) wywala mi b??d
w consoli a posta?(NPC) nie pojawia si? w grze i nie wiem co jest grane...
mo?na prosi? o pomoc?
Mam problem ot?? gdy chce zrobi? scrypt teleportacji
chce ?eby by? wyb?r do starego i nowego miejsca(questa)
niestety gdy wpisuje scrypt (podany ni?ej) wywala mi b??d
w consoli a posta?(NPC) nie pojawia si? w grze i nie wiem co jest grane...
mo?na prosi? o pomoc?
Code:
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
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 and getPlayerPz(cid) <= 0 then
selfSay('Well, well, well.. do you want to start your reborn quest?')
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, 'old') then
travel(cid, 513, 57, 0)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
end
end
end
elseif msgcontains(msg, 'new') then
if pay(cid,0) then
travel(cid, 117, 101, 7)
selfSay('Let\'s go!')
focus = 0
talk_start = 0
else
selfSay('Sorry, you don\'t have enough money.')
end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. getCreatureName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 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