Grehy
Killroy
I have a script so far, it broadcasts the message, it just can't get the playername to be broadcasted in it. Can someone fix it for me please?
Code:
focus = 1
talk_start = 1
target = 1
following = false
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 getPlayerAccess(cid) == 1) then
selfSay('Hello, |PLAYERNAME|. Do you want to broadcast that your online?')
focus = cid
talk_start = os.clock()
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'stop saying this idiot') then
selfSay('Why I oughta....')
elseif msgcontains(msg, 'yes') then
doBroadcastMessage("Our tutor |NAME| is online!",22)
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Whatever Man.')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
if focus == 0 then
cx, cy, cz = selfGetPosition()
randmove = math.random(1,25)
if randmove == 1 then
nx = cx + 1
end
if randmove == 2 then
nx = cx - 1
end
if randmove == 3 then
ny = cy + 1
end
if randmove == 4 then
ny = cy - 1
end
if randmove >= 5 then
nx = cx
ny = cy
end
moveToPosition(nx, ny, cz)
--summons = 30
--summons2 = 30
end
if focus == 0 then
randsay = math.random(1,75)
if randsay == 1 then
selfSay('Gonna break me...')
end
if randsay == 2 then
selfSay('The staff here sometimes jeez.')
end
end