• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua 7,6 Account manager

hayrien

New Member
Joined
Sep 2, 2014
Messages
85
Reaction score
3
Location
Norway
I'm only missing the vocation choser Scripts, please help me.

Code:
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
accstatus = 0
seksik = 3
myname = ''
mypass = ''
maxnamelen = 10
maxpasslen = 10
allow_pattern = '^[a-zA-Z0-9 -]+$'
origmsg = ''
mypasscheck = ''
mynamecheck = ''

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)
origmsg = msg
msg = string.lower(msg)



if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Hello, welcome to Illusion OT. Are you male or female?')
accstatus = 1
myname = ''
mypass = ''
myaccnumber = 0
seksik = 0
focus = cid
talk_start = os.clock()


elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Please wait')


elseif focus == cid then
talk_start = os.clock()



if msgcontains(msg, 'male') and accstatus == 1 then
selfSay('Ok, What is your name?')
seksik = 1
accstatus = 2
elseif msgcontains(msg, 'famale') and accstatus == 1 then
selfSay('Ok, What is your name?')
seksik = 0
accstatus = 2


elseif accstatus == 2 then
myname = origmsg
mynamecheck = msg
if string.len(mynamecheck) <= maxnamelen then
if string.find(mynamecheck, allow_pattern) then
if io.open("data/players/"..myname..".xml" , "r") == nil then
selfSay('Is '..myname..' your name?')
accstatus = 3
else
selfSay('Name already exist, please give me another one')
end
else
selfSay('Illegal characters, try another')
end
else
selfSay('Name is too long! Max is 10, try again')
end
elseif msgcontains(msg, 'yes') then
if accstatus == 3 then
selfSay('Ok, Now what will your password be?')
accstatus = 4
elseif accstatus == 5 then
if seksik == 0 then
selfSay('Ok. Lets check: You are a woman, your name is '..myname..' and your password is: '..mypass..'?')
else
selfSay('Ok. Lets check: You are a man, your name is '..myname..' and your password is: '..mypass..'?')
end
accstatus = 6
elseif accstatus == 6 then
selfSay('We will now randomize your account number, say rand')
accstatus = 7
end
elseif msgcontains(msg, 'no') then
if accstatus == 3 then
selfSay('Choose another')
accstatus = 2
elseif accstatus == 5 then
selfSay('Choose another')
accstatus = 4
elseif accstatus == 6 then
selfSay('Again, you are a man or a woman?')
accstatus = 1
end
elseif accstatus == 4 then
mypass = origmsg
mypasscheck = msg
if string.len(mypasscheck) <= maxpasslen then
if string.find(mypasscheck, allow_pattern) then
selfSay('Your password is '..mypass..' correct?')
accstatus = 5
else
selfSay('Illegal characters, try another')
end
else
selfSay('too long! Max is 6, give other')
end

elseif msgcontains(msg, 'rand') and accstatus == 7 then
myaccnumber = math.random(100000,999999)
if io.open("data/accounts/"..myaccnumber..".xml" , "r") == nil then
selfSay('your account number is'..myaccnumber..' Say NEXT to continue')
accstatus = 8
f = assert(io.open("./data/accounts/"..myaccnumber..".xml", "w"))
f = io.open("./data/accounts/"..myaccnumber..".xml", "w")
f:write("<?xml version=\"1.0\"?><account pass=\""..mypass.."\" type=\"1\" premDays=\"666\"><characters><character name=\""..myname.."\"\/><\/characters><\/account>")
f:close()

f = assert(io.open("./data/players/"..myname..".xml", "w"))
f = io.open("./data/players/"..myname..".xml", "w")
f:write("<?xml version=\"1.0\"?><player name=\""..myname.."\" account=\""..myaccnumber.."\" sex=\""..seksik.."\" lookdir=\"3\" exp=\"1\" voc=\"0\" level=\"1\" access=\"0\" cap=\"1\" maglevel=\"1\" lastlogin=\"0\" premticks=\"0\" promoted=\"1\" banned=\"0\"><spawn x=\"176\" y=\"108\" z=\"8\"\/><temple x=\"176\" y=\"108\" z=\"8\"\/><skull type=\"0\" kills=\"0\" ticks=\"0\" absolve=\"0\"\/><health now=\"150\" max=\"150\" food=\"1000\"\/><mana now=\"1\" max=\"1\" spent=\"1\"\/><look type=\"134\" head=\"77\" body=\"79\" legs=\"78\" feet=\"77\"\/><skills><skill skillid=\"0\" level=\"10\" tries=\"0\"\/><skill skillid=\"1\" level=\"10\" tries=\"0\"\/><skill skillid=\"2\" level=\"10\" tries=\"0\"\/><skill skillid=\"3\" level=\"10\" tries=\"0\"\/><skill skillid=\"4\" level=\"10\" tries=\"0\"\/><skill skillid=\"5\" level=\"10\" tries=\"0\"\/><skill skillid=\"6\" level=\"10\" tries=\"0\"\/><\/skills><spells><spell words=\"utevo lux\"\/><\/spells><deaths\/><inventory><slot slotid=\"3\"><item id=\"1994\"><inside><item id=\"2674\" count=\"1\"\/><\/inside><\/item><\/slot><slot slotid=\"4\"><item id=\"2650\"\/><\/slot><slot slotid=\"6\"><item id=\"2382\"\/><\/slot><slot slotid=\"7\"><item id=\"2649\"\/><\/slot><slot slotid=\"8\"><item id=\"2643\"\/><\/slot><\/inventory><depots><depot depotid=\"1\"><item id=\"2591\"><inside><item id=\"2594\"\/><\/inside><\/item><\/depot><\/depots><storage><data key=\"777\" value=\""..seksik.."\"\/><\/storage><\/player>")
f:close()
else
selfSay('Error number allready exist. Say again RAND neagain ')
end



elseif msgcontains(msg, 'next') and accstatus == 8 then
selfSay('your account number is '..myaccnumber..', and your password is '..mypass..'.')
accstatus = 0
elseif msgcontains(msg, 'links') then
selfSay('URLS')




elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
accstatus = 0
myname = ''
mypass = ''
myaccnumber = 0
seksik = ''
talk_start = 0
end
end
end


function onCreatureChangeOutfit(creature)

end


function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Have fun!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Do zobaczenia')
focus = 0
end
end
end
 
Last edited by a moderator:
Back
Top