• 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!

[Request] [NPC] Account Maker (acc and player) or ideas to make it

narko

vertrauenswürdig ~
Joined
Oct 19, 2008
Messages
1,317
Solutions
2
Reaction score
131
Location
Unknown
I need npc account maker to my war pvp-e server..


i gives rep!!!
 
noo i need npc no acc manager im need npc for a war server

30 kills = account door = account npc = account
 
im made this for a 7.5 OT. it was a XML server so it wont work but if u can figure out the SQL commands to replace the xml code at the bottom it should do just fine
Code:
----------------------------Account creator by Bazzag-----------------------------------------
----------------------------!Recreated and edited by!-----------------------------------------
----------------------------**Soul4soul A.K.A Lord**------------------------------------------

---little config-----------------------------------------
templex = 1000
templey = 1000
templez = 7

maxnamelen = 14
maxpasslen = 14
maxaccclen = 10

startlvl = 20
startexp = 98800
vocations = 0
healthstart = 1000
manastart = 1000
depoitemid = 2591
promoted = 0
---------skills-------------------------
mlvl = 1
fist = 10
club = 10
sword = 10
axe = 10
dist = 10
shield = 10
fish = 10
cap = 100
---end little config-----------------------------------------
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
accstatus = 0
sex = 3
myname = ''
mypass = ''
myaccnumber = ''
allow_pattern = '^[a-zA-Z0-9 -]+$'
origmsg = ''
mypasscheck = ''
mynamecheck = ''
vocation = 0

function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
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, for your account we need to know if you are a man or a woman. Please answer with "man" or "woman". (Without quotes!)')
		accstatus = 1
		myname = ''
		mypass = ''
		myaccnumber = 0
		focus = cid
		talk_start = os.clock()
	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
		selfSay('Cant You see I am talking?')
	elseif focus == cid then
		talk_start = os.clock()
		if accstatus == 1 then
			if msgcontains(msg, 'man') then
				selfSay('And what do you wish to be called by sir?')
				sex = 1
				accstatus = 2
			elseif msgcontains(msg, 'woman') then
				selfSay('And what do you wish to be called by miss?')
				sex = 0
				accstatus = 2
			end
		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('The name you picked is '..myname..'. Is this allright?')
						accstatus = 3
					else
						selfSay('That name is already in use! Please pick another one.')
					end
				else
					selfSay('Illegal characters in the name! Please pick another one.')
				end
			else
				selfSay('Your name is too long! Please pick another one.')
			end
		elseif msgcontains(msg, 'yes') then
			if accstatus == 3 then
				if vocations == 0 then
					selfSay('What password do you want to have?')
					vocation = 0
					accstatus = 4
				else
					selfSay('What vocation do you want to follow? You can pick one of these: a "Paladin", a "Knight", a "Druid" or a "Sorcerer".')
					accstatus = 66
				end
			elseif accstatus == 5 then
				if sex == 0 then
					selfSay('Allright. Here are the facts; You are a woman named: '..myname..' and your password is '..mypass..'. Is this allright?')
				else
					selfSay('Allright. Here are the facts; You are a man named: '..myname..' and your password is '..mypass..'. Is this allright?')
				end
				accstatus = 67
			elseif msgcontains(msg, 'yes') and accstatus == 67 then
				selfSay('What vocation do you want to follow? You can pick one of these: a "Paladin", a "Knight", a "Druid" or a "Sorcerer".')
			accstatus = 66.
			elseif accstatus == 66 then
				if msgcontains(msg, 'paladin') then
					selfSay('Do you want to be a Paladin?')
					vocation = 3
				elseif msgcontains(msg, 'sorcerer') then
					selfSay('Do you want to be a Sorcerer?')
					vocation = 1
				elseif msgcontains(msg, 'druid') then
					selfSay('Do you want to be a Druid?')
					vocation = 2
				elseif msgcontains(msg, 'knight') then
					selfSay('Do you want to be a Knight?')
					vocation = 4
				else
					selfSay('Sorry, I can not understand that. Could you type again?')
				end
				accstatus = 68
			elseif msgcontains(msg, 'yes') and accstatus == 68 then
				selfSay('Lets get an account number. Do not forget to write this number down somewhere! Are you ready for it? Please answer with "account" or "bye".')
				accstatus = 7
			elseif accstatus == 3 then
				selfSay('What password do you want to have?')
				accstatus = 4
			end
		elseif msgcontains(msg, 'not') then
			if accstatus == 3 then
				selfSay('Please pick another one.')
				accstatus = 2
			elseif accstatus == 5 then
				selfSay('Please pick another one.')
				accstatus = 4
			elseif accstatus == 6 then
				selfSay('Start again. Hello, for your account we need to know if you are a man or a woman. Please answer with "man" or "woman". (Without quotes!)')
				accstatus = 1
			elseif accstatus == 67 then
				selfSay('What vocation do you want to follow? You can pick one of these: a "Paladin", a "Knight", a "Druid" or a "Sorcerer".')
				accstatus = 66
			end
		elseif accstatus == 4 then
			mypass = origmsg
			mypasscheck = msg
			if string.len(mypasscheck) <= maxpasslen then
				if string.find(mypasscheck, allow_pattern) then
					selfSay('The password you picked is '..mypass..'. Is this allright?')
					accstatus = 5
				else
					selfSay('Illegal characters in the password! Please pick another one.')
				end
			else
				selfSay('Password is too long! Please pick another one.')
			end
		elseif msgcontains(msg, 'account') and accstatus == 7 then
			selfSay('What account number do you want to have?')
			accstatus = 8
		elseif accstatus == 8 then
			myaccnumber = origmsg
			if string.len(myaccnumber) <= maxaccclen then
				if string.find(myaccnumber, allow_pattern) then
					if io.open("data/accounts/"..myaccnumber..".xml" , "r") == nil then
						selfSay('Your Account number is; '..myaccnumber..'. Please say "alright" if it is ok no "no" if it is wrong.')
						accstatus = 9
					else
						selfSay('That account number is already in use! Please pick another one.')
					end
				else
					selfSay('Illegal characters in your account number! Please pick another one.')
				end
			else
				selfSay('Your account number is too long! Please pick another one.')
			end
		elseif msgcontains(msg, 'alright') and accstatus == 9 then
			selfSay('Please wait will I process your account.')
			accstauts = 10f = 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=\"0\"><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=\""..sex.."\" lookdir=\"1\" exp=\""..startexp.."\" voc=\""..vocation.."\" level=\""..startlvl.."\" access=\"0\" cap=\""..cap.."\" maglevel=\""..mlvl.."\" lastlogin=\"0\" premticks=\"0\" promoted=\""..promoted.."\" banned=\"0\"><spawn x=\""..templex.."\" y=\""..templey.."\" z=\""..templez.."\"\/><temple x=\""..templex.."\" y=\""..templey.."\" z=\""..templez.."\"\/><skull type=\"0\" kills=\"0\" ticks=\"0\" absolve=\"0\"\/><health now=\""..healthstart.."\" max=\""..healthstart.."\" food=\"1000\"\/><mana now=\""..manastart.."\" max=\""..manastart.."\" spent=\"1\"\/><look type=\"134\" head=\"77\" body=\"79\" legs=\"78\" feet=\"77\"\/><skills><skill skillid=\"0\" level=\""..fist.."\" tries=\"0\"\/><skill skillid=\"1\" level=\""..club.."\" tries=\"0\"\/><skill skillid=\"2\" level=\""..sword.."\" tries=\"0\"\/><skill skillid=\"3\" level=\""..axe.."\" tries=\"0\"\/><skill skillid=\"4\" level=\""..dist.."\" tries=\"0\"\/><skill skillid=\"5\" level=\""..shield.."\" tries=\"0\"\/><skill skillid=\"6\" level=\""..fish.."\" 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=\""..depoitemid.."\"><inside><item id=\"2594\"\/><\/inside><\/item><\/depot><\/depots><storage><data key=\"777\" value=\""..sex.."\"\/><\/storage><\/player>")
			f:close()
			selfSay('Your account has been processed say "next" to conform your account information')
		elseif msgcontains(msg, 'no') or msgcontains(msg, 'no') and accountstatus == 9 then
			selfSay('!!ERROR!! Please say "bye" and restart to create an account.')
			accstatus = 0
		elseif msgcontains(msg, 'next') and accstatus == 10 then
			selfSay('This is your account; your account number is '..myaccnumber..' and your password is '..mypass..'. Please say "bye" and your account will be finished!')
			accstatus = 0
		elseif msgcontains(msg, 'links') then
			selfSay('Link to the offical web page, there are none. ---links---')
			accstatus = 0
		elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
			focus = 0
			ccstatus = 0
			myname = ''
			mypass = ''
			myaccnumber = ''
			sex = ''
			talk_start = 0
		end	
	end
end


function onThink()
	if (os.clock() - talk_start) > 30 then
		if focus > 0 then
			selfSay('A little slow are we?')
		end
		focus = 0
	end
	if focus ~= 0 then
		if getDistanceToCreature(focus) > 5 then
			selfSay('You dont want an account?')
			focus = 0
		end
	end
end

edit:wow just read it over again that code is rlly old and can be rewritten to be 10times more efficent. but when i used it on 7.5 it worked so it will now but like i sayd you need to update it to read SQL and not XML
edit2: just made the code a little easier to read added tabs fixed some typos. hopefully you can figure out the rest now
 
Last edited:
wont works beacause in actually use mysql and this npc is for xml server

and mysql need querys
no duh i said that in my post but its a good base and wouldnt be to difficult to update from xml to sql............

Maaaybe I'll rewrite it to MySQL version.. if I'll have some free time.
thatd be cool. you just need to remove the XML part and then you only need 2 sql inserts if im not mistaken. really it could use a total rewrite that would be ideal it could be made quite a bit shorter.
 
I'm sure I'll add vocations config for new characters (table with info about each vocation parameters) and make it support (new?!) npc system (NPC chat window).
 
id just like to have this for my self also so iv updated it more. it still need work so i hope that you will finish it pho. i reorganized it and cleaned it up. 40lines shorter. everything should work except for the sql injections. i got to lazy so i left out the values part of the injection. i highlighted that part in red.

Code:
----------------------------Account creator by Bazzag-----------------------------------------
----------------------------!Recreated and edited by!-----------------------------------------
----------------------------**Soul4soul A.K.A Lord**------------------------------------------

---little config-----------------------------------------
templex = 1000
templey = 1000
templez = 7

maxnamelen = 14
maxpasslen = 14
maxaccclen = 10

startlvl = 20
startexp = 98800
vocations = 0
healthstart = 1000
maleastart = 1000
depoitemid = 2591
promoted = 0
---------skills-------------------------
mlvl = 1
fist = 10
club = 10
sword = 10
axe = 10
dist = 10
shield = 10
fish = 10
cap = 100
---end little config-----------------------------------------
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
accstatus = 0
sex = 3
myname = ''
mypass = ''
myaccnumber = 0
allow_pattern = '^[a-zA-Z0-9 -]+$'
origmsg = ''
mypasscheck = ''
mynamecheck = ''
vocation = 0

function onCreatureDisappear(cid, pos)
	if focus == cid then
		selfSay('Good bye then.')
		focus = 0
		talk_start = 0
	end
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, for your account we need to know if you are a male or a female. Please answer with "male" or "female". (Without quotes!)')
		accstatus = 1
		focus = cid
		talk_start = os.clock()
	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
		selfSay('Cant You see I am talking?')
	elseif focus == cid then
		talk_start = os.clock()
		if accstatus == 1 then
			if msgcontains(msg, 'male') then
				selfSay('And what do you wish to be called by sir?')
				sex = 1
				accstatus = 2
			elseif msgcontains(msg, 'female') then
				selfSay('And what do you wish to be called by miss?')
				sex = 0
				accstatus = 2
			else
				selfSay('Try again I asked if you would like to be a male or female?')
			end
		elseif accstatus == 2 then
			myname = origmsg
			mynamecheck = msg
			if string.len(mynamecheck) <= maxnamelen then
				if string.find(mynamecheck, allow_pattern) then
					local result_plr = db.getResult("SELECT * FROM players WHERE `name` = '"..myname.."';")
					if(result_plr:getID() ~= -1) then
						selfSay('That name is already in use! Please pick another one.')
					else
						selfSay('The name you picked is '..myname..'. Is this alright?')
						accstatus = 3
					end
				else
					selfSay('Illegal characters in the name! Please pick another one.')
				end
			else
				selfSay('Your name is too long! Please pick another one.')
			end
		elseif accstatus == 4 then
			mypass = origmsg
			mypasscheck = msg
			if string.len(mypasscheck) <= maxpasslen then
				if string.find(mypasscheck, allow_pattern) then
					selfSay('The password you picked is '..mypass..'. Is this alright?')
					accstatus = 5
				else
					selfSay('Illegal characters in the password! Please pick another one.')
				end
			else
				selfSay('Password is too long! Please pick another one.')
			end
		elseif accstatus == 6 then
			accstatus = 7
			if msgcontains(msg, 'paladin') then
				selfSay('Do you want to be a Paladin?')
				vocation = 3
			elseif msgcontains(msg, 'sorcerer') then
				selfSay('Do you want to be a Sorcerer?')
				vocation = 1
			elseif msgcontains(msg, 'druid') then
				selfSay('Do you want to be a Druid?')
				vocation = 2
			elseif msgcontains(msg, 'knight') then
				selfSay('Do you want to be a Knight?')
				vocation = 4
			else
				selfSay('Sorry, I can not understand that. Could you type again?')
				accstatus = 6
			end
		elseif accstatus == 8 then
			myaccnumber = origmsg
			if string.len(myaccnumber) <= maxaccclen then
				if string.find(myaccnumber, allow_pattern) then
					local result_plr = db.getResult("SELECT * FROM accounts WHERE `name` = '"..myaccnumber.."';")
					if(result_plr:getID() ~= -1) then
						selfSay('That account name is already in use! Please pick another one. What would you like your account number to be?')
					else
						selfSay('Your Account name is; '..myaccnumber..'. Now let us review everything quickly before your account is processed, is that okay?')
						accstatus = 9
					end
				else
					selfSay('Illegal characters in your account name! Please pick another one.')
				end
			else
				selfSay('Your account name is too long! Please pick another one.')
			end
		elseif msgcontains(msg, 'yes') then
			if accstatus == 3 then
				selfSay('Good now, What password do you want to have?')
				vocation = 0
				accstatus = 4
			elseif accstatus == 5 then
				selfSay('What vocation do you want to follow? You can pick one of these: a "Paladin", a "Knight", a "Druid" or a "Sorcerer".')
				accstatus = 6
			elseif accstatus == 7 then
				selfSay('Good. Lets get an account name. Do not forget to write this number down somewhere! So what would you like you account name to be?')
				accstatus = 8
			elseif accstatus == 9 then
				if sex == 0 then
					selfSay('So, You a male with the name '..myname..'. Your account name is ' ..myaccnumber.. ' and you would like your password to be ..' ..mypass.. '. Is this corrct?')
				else
					selfSay('So, You a female with the name '..myname..'. Your account name is ' ..myaccnumber.. ' and you would like your password to be ..' ..mypass.. '. Is this corrct?')
				end
				accstatus = 10
			elseif accstatus == 10 then
				[COLOR="red"]db.executeQuery("INSERT INTO `accounts` (`id`, `name`, `password`, `premdays`, `lastday`, `email`, `key`, `blocked`, `warnings`, `group_id`, `page_access`, `page_lastday`, `email_new`, `rlname`, `location`, `created`, `email_code`, `next_email`, `premium_points`, `nickname`, `avatar`, `about_me`) VALUES ('NULL', '" .. myname .. "', '" .. mypass .. "', '0', '1290265117', 'NULL', '1290265117', '', '0', '0', '1', 'NULL', 'NULL', 'NULL', 'NULL', '', '', 'NULL', 'NULL', 'NULL', '" .. os.time() .. "', 'NULL', 'NULL', '0', 'NULL', 'NULL', 'NULL');")
				db.executeQuery("INSERT INTO `players` (`id`, `name`, `world_id`, `group_id `, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `rank_id `, `guildnick`, `lastlogout`, `blessings`, `balance`, `stamina`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_containers `, `loss_items`, `premend`, `online`, `marriage`, `promotion `, `deleted`, `description`, `old_name`, `hide_char`, `worldtransfer`, `created`, `nick_verify`, `comment`) VALUES ('NULL', '" .. myname .. "', '" .. mypass .. "', '0', '1290265117', 'NULL', '1290265117', '', '0', '0', '1', 'NULL', 'NULL', 'NULL', 'NULL', '', '', 'NULL', 'NULL', 'NULL', '" .. os.time() .. "', 'NULL', 'NULL', '0', 'NULL', 'NULL', 'NULL');")[/COLOR]
				selfSay('Thanks you please wait well your account is processed........ .... .. . . . Your account is down please log out and log in with your new account.')
			end
		elseif msgcontains(msg, 'no') then
			if accstatus == 3 then
				selfSay('Please pick another name.')
				accstatus = 2
			elseif accstatus == 5 then
				selfSay('Please pick another password.')
				accstatus = 4
			elseif accstatus == 9 then
				selfSay('Please pick an account nam.')
				accstatus = 8
			end
		elseif msgcontains(msg, 'links') then
			selfSay('Link to the offical web page, http://wonderingsouls.no-ip.org/.')
			accstatus = 0
		elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
			focus = 0
			ccstatus = 0
			myname = ''
			mypass = ''
			myaccnumber = ''
			sex = 3
			talk_start = 0
		end	
	end
end


function onThink()
	if (os.clock() - talk_start) > 30 then
		if focus > 0 then
			selfSay('A little slow are we?')
		end
		focus = 0
	end
	if focus ~= 0 then
		if getDistanceToCreature(focus) > 5 then
			selfSay('You dont want an account?')
			focus = 0
		end
	end
end
 
id just like to have this for my self also so iv updated it more. it still need work so i hope that you will finish it pho. i reorganized it and cleaned it up. 40lines shorter. everything should work except for the sql injections. i got to lazy so i left out the values part of the injection. i highlighted that part in red.

Code:
----------------------------Account creator by Bazzag-----------------------------------------
----------------------------!Recreated and edited by!-----------------------------------------
----------------------------**Soul4soul A.K.A Lord**------------------------------------------

---little config-----------------------------------------
templex = 1000
templey = 1000
templez = 7

maxnamelen = 14
maxpasslen = 14
maxaccclen = 10

startlvl = 20
startexp = 98800
vocations = 0
healthstart = 1000
maleastart = 1000
depoitemid = 2591
promoted = 0
---------skills-------------------------
mlvl = 1
fist = 10
club = 10
sword = 10
axe = 10
dist = 10
shield = 10
fish = 10
cap = 100
---end little config-----------------------------------------
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
accstatus = 0
sex = 3
myname = ''
mypass = ''
myaccnumber = 0
allow_pattern = '^[a-zA-Z0-9 -]+$'
origmsg = ''
mypasscheck = ''
mynamecheck = ''
vocation = 0

function onCreatureDisappear(cid, pos)
	if focus == cid then
		selfSay('Good bye then.')
		focus = 0
		talk_start = 0
	end
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, for your account we need to know if you are a male or a female. Please answer with "male" or "female". (Without quotes!)')
		accstatus = 1
		focus = cid
		talk_start = os.clock()
	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
		selfSay('Cant You see I am talking?')
	elseif focus == cid then
		talk_start = os.clock()
		if accstatus == 1 then
			if msgcontains(msg, 'male') then
				selfSay('And what do you wish to be called by sir?')
				sex = 1
				accstatus = 2
			elseif msgcontains(msg, 'female') then
				selfSay('And what do you wish to be called by miss?')
				sex = 0
				accstatus = 2
			else
				selfSay('Try again I asked if you would like to be a male or female?')
			end
		elseif accstatus == 2 then
			myname = origmsg
			mynamecheck = msg
			if string.len(mynamecheck) <= maxnamelen then
				if string.find(mynamecheck, allow_pattern) then
					local result_plr = db.getResult("SELECT * FROM players WHERE `name` = '"..myname.."';")
					if(result_plr:getID() ~= -1) then
						selfSay('That name is already in use! Please pick another one.')
					else
						selfSay('The name you picked is '..myname..'. Is this alright?')
						accstatus = 3
					end
				else
					selfSay('Illegal characters in the name! Please pick another one.')
				end
			else
				selfSay('Your name is too long! Please pick another one.')
			end
		elseif accstatus == 4 then
			mypass = origmsg
			mypasscheck = msg
			if string.len(mypasscheck) <= maxpasslen then
				if string.find(mypasscheck, allow_pattern) then
					selfSay('The password you picked is '..mypass..'. Is this alright?')
					accstatus = 5
				else
					selfSay('Illegal characters in the password! Please pick another one.')
				end
			else
				selfSay('Password is too long! Please pick another one.')
			end
		elseif accstatus == 6 then
			accstatus = 7
			if msgcontains(msg, 'paladin') then
				selfSay('Do you want to be a Paladin?')
				vocation = 3
			elseif msgcontains(msg, 'sorcerer') then
				selfSay('Do you want to be a Sorcerer?')
				vocation = 1
			elseif msgcontains(msg, 'druid') then
				selfSay('Do you want to be a Druid?')
				vocation = 2
			elseif msgcontains(msg, 'knight') then
				selfSay('Do you want to be a Knight?')
				vocation = 4
			else
				selfSay('Sorry, I can not understand that. Could you type again?')
				accstatus = 6
			end
		elseif accstatus == 8 then
			myaccnumber = origmsg
			if string.len(myaccnumber) <= maxaccclen then
				if string.find(myaccnumber, allow_pattern) then
					local result_plr = db.getResult("SELECT * FROM accounts WHERE `name` = '"..myaccnumber.."';")
					if(result_plr:getID() ~= -1) then
						selfSay('That account name is already in use! Please pick another one. What would you like your account number to be?')
					else
						selfSay('Your Account name is; '..myaccnumber..'. Now let us review everything quickly before your account is processed, is that okay?')
						accstatus = 9
					end
				else
					selfSay('Illegal characters in your account name! Please pick another one.')
				end
			else
				selfSay('Your account name is too long! Please pick another one.')
			end
		elseif msgcontains(msg, 'yes') then
			if accstatus == 3 then
				selfSay('Good now, What password do you want to have?')
				vocation = 0
				accstatus = 4
			elseif accstatus == 5 then
				selfSay('What vocation do you want to follow? You can pick one of these: a "Paladin", a "Knight", a "Druid" or a "Sorcerer".')
				accstatus = 6
			elseif accstatus == 7 then
				selfSay('Good. Lets get an account name. Do not forget to write this number down somewhere! So what would you like you account name to be?')
				accstatus = 8
			elseif accstatus == 9 then
				if sex == 0 then
					selfSay('So, You a male with the name '..myname..'. Your account name is ' ..myaccnumber.. ' and you would like your password to be ..' ..mypass.. '. Is this corrct?')
				else
					selfSay('So, You a female with the name '..myname..'. Your account name is ' ..myaccnumber.. ' and you would like your password to be ..' ..mypass.. '. Is this corrct?')
				end
				accstatus = 10
			elseif accstatus == 10 then
				[COLOR="red"]db.executeQuery("INSERT INTO `accounts` (`id`, `name`, `password`, `premdays`, `lastday`, `email`, `key`, `blocked`, `warnings`, `group_id`, `page_access`, `page_lastday`, `email_new`, `rlname`, `location`, `created`, `email_code`, `next_email`, `premium_points`, `nickname`, `avatar`, `about_me`) VALUES ('NULL', '" .. myname .. "', '" .. mypass .. "', '0', '1290265117', 'NULL', '1290265117', '', '0', '0', '1', 'NULL', 'NULL', 'NULL', 'NULL', '', '', 'NULL', 'NULL', 'NULL', '" .. os.time() .. "', 'NULL', 'NULL', '0', 'NULL', 'NULL', 'NULL');")
				db.executeQuery("INSERT INTO `players` (`id`, `name`, `world_id`, `group_id `, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `lookaddons`, `maglevel`, `mana`, `manamax`, `manaspent`, `soul`, `town_id`, `posx`, `posy`, `posz`, `conditions`, `cap`, `sex`, `lastlogin`, `lastip`, `save`, `skull`, `skulltime`, `rank_id `, `guildnick`, `lastlogout`, `blessings`, `balance`, `stamina`, `direction`, `loss_experience`, `loss_mana`, `loss_skills`, `loss_containers `, `loss_items`, `premend`, `online`, `marriage`, `promotion `, `deleted`, `description`, `old_name`, `hide_char`, `worldtransfer`, `created`, `nick_verify`, `comment`) VALUES ('NULL', '" .. myname .. "', '" .. mypass .. "', '0', '1290265117', 'NULL', '1290265117', '', '0', '0', '1', 'NULL', 'NULL', 'NULL', 'NULL', '', '', 'NULL', 'NULL', 'NULL', '" .. os.time() .. "', 'NULL', 'NULL', '0', 'NULL', 'NULL', 'NULL');")[/COLOR]
				selfSay('Thanks you please wait well your account is processed........ .... .. . . . Your account is down please log out and log in with your new account.')
			end
		elseif msgcontains(msg, 'no') then
			if accstatus == 3 then
				selfSay('Please pick another name.')
				accstatus = 2
			elseif accstatus == 5 then
				selfSay('Please pick another password.')
				accstatus = 4
			elseif accstatus == 9 then
				selfSay('Please pick an account nam.')
				accstatus = 8
			end
		elseif msgcontains(msg, 'links') then
			selfSay('Link to the offical web page, http://wonderingsouls.no-ip.org/.')
			accstatus = 0
		elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
			focus = 0
			ccstatus = 0
			myname = ''
			mypass = ''
			myaccnumber = ''
			sex = 3
			talk_start = 0
		end	
	end
end


function onThink()
	if (os.clock() - talk_start) > 30 then
		if focus > 0 then
			selfSay('A little slow are we?')
		end
		focus = 0
	end
	if focus ~= 0 then
		if getDistanceToCreature(focus) > 5 then
			selfSay('You dont want an account?')
			focus = 0
		end
	end
end

i will test
 
Back
Top