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

Acc Maker NPC (Mostly Done)

Elvang

Member
Joined
Feb 11, 2008
Messages
633
Reaction score
14
Location
Canada, B.C.
Hello, I created a script to create accounts for a pvp enforced server, if someone would like to finish it up and release it here that would be awsome.

Some things that need to be done:
-Check the account against the database
-Create the account
-Check the player name in the database
-Create the player

This can be done with luasql or what ever way you come up with :)

Lua:
--Credits go to Elvang--

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local talkState = {}
function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)          npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                                                      npcHandler:onThink()                                            end

function creatureSayCallback(cid, type, msg)
        if(not npcHandler:isFocused(cid)) then
                return false
end

--Config--
--Player Config--
local Player_Name = ""
local Player_Sex = 3
local Player_Vocation = ""
local Player_Max_Length_name = 15
local Player_Spawn_X = 1000
local Player_Spawn_Y = 1000
local Player_Spawn_Z = 7
local Player_Level = 8
local Player_Experience  = 4200
local Player_Promoted = 0
local Player_Vocation = 0
local Player_health = 0
local Player_mana = 0
local Player_melee_skills = 0
local Player_distance_skill = 0
local Player_Mag_level = 0

--Account Config--
local Account_Number = ""
local Account_Password = ""

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--Finds the characters sex
if (msgcontains(msg, 'account')) then
        selfSay('What is your sex? Are you male or female?', cid)
        talkState[talkUser] = 1
--Male
elseif (msgcontains(msg, 'male')) and talkState[talkUser] == 1 then
        selfSay('So you are a man, and what would you like your name to be?', cid)
        Player_Sex = 1
        talkState[talkUser] = 2
--Female
elseif (msgcontains(msg, 'female')) and talkState[talkUser] == 1 then
        selfSay('So you are a woman, and what would you like your name to be?', cid)
        Player_Sex = 2
        talkState[talkUser] = 2
--Finds the players name
elseif (talkState[talkUser] == 2) then
        Player_Name = msg
        selfSay('Are you sure you want your name to be '..Player_Name..'?', cid)
        talkState[talkUser] = 3
--If no resets to repick name
elseif (msgcontains(msg, 'no')) and talkState[talkUser] == 3 then
        selfSay('I\'m sorry to hear that, why don\'t you try again? Which name would you like to pick?', cid)
        Player_Name = ""
        talkState[talkUser] = 2
--If yes continue to pick vocation--
elseif (msgcontains(msg, 'yes')) and talkState[talkUser] == 3 then
        selfSay('Great! So, what vocation would you like to be? A crafty Paladin, a brutal Knight, a powerful Sorcerer, or a helpful Druid?', cid)
        talkState[talkUser] = 4
--Diff msg depending on a person vocation chosen--
elseif (msgcontains(msg, 'paladin')) and talkState[talkUser] == 4 then
        selfSay('Awesome! A powerful paladin. Lets get started with your account shall we? What would you like your account number to be?', cid)
        talkState[talkUser] = 5
        Player_Vocation = 3
        Player_health = 185
        Player_mana = 35
        Player_melee_Skills = 10
        Player_Mag_level = 18
        Player_distance_skill = 90
elseif (msgcontains(msg, 'knight')) and talkState[talkUser] == 4 then
        selfSay('Awesome! A powerful knight. Let\'s get started with your account shall we? What would you like your account number to be?', cid)
        talkState[talkUser] = 5
        Player_Vocation = 4
        Player_health = 185
        Player_mana = 35
        Player_melee_Skills = 95
        Player_Mag_level = 8
        Player_distance_skill = 10
elseif (msgcontains(msg, 'sorcerer')) and talkState[talkUser] == 4 then
        selfSay('Awesome! A powerful sorcerer. Let\'s get started with your account shall we? What would you like your account number to be?',cid)
        talkState[talkUser] = 5
        Player_Vocation = 1
        Player_health = 185
        Player_mana = 35
        Player_melee_Skills = 10
        Player_Mag_level = 85
        Player_distance_skill = 10
elseif (msgcontains(msg, 'druid')) and talkState[talkUser] == 4 then
        selfSay('Awesome! A powerful druid. Let\'s get started with your account shall we? What would you like your account number to be?',cid)
        talkState[talkUser] = 5
        Player_Vocation = 2
        Player_health = 185
        Player_mana = 35
        Player_melee_Skills = 10
        Player_Mag_level = 85
        Player_distance_skill = 10
--Finds the persons account
elseif (talkState[talkUser] == 5) then
        Account_Number = msg
        selfSay('Alrighty then, what would you like your password to be?', cid)
        talkState[talkUser] = 6
--Finds the persons password
elseif (talkState[talkUser] == 6) then
        Account_Password = msg
        selfSay('We are nearly done now, your password will be '..Account_Password..', is this fine with you? ', cid)
        talkState[talkUser] = 7
--Checks the persons password
elseif (msgcontains(msg, 'no')) and talkstate[talkUser] == 7 then
        selfSay('Thats fine, please try again. What would you like you password to be?', cid)
        Account_Password = ""
        talkState = 6
elseif (msgcontains(msg, 'yes')) and talkState[talkUser] == 7 then
        selfSay('It is done, you account and character are created! Have fun and don\'t forget to follow the rules.', cid)
        --db.executeQuery("INSERT INTO accounts (name, password) VALUES(".. Account_Number ..", ".. Account_Password ..")")
        --db.executeQuery("INSERT INTO players (name, world_id, group_id, account_id, level, vocation, health, healthmax, experience, looktype, lookaddons, maglevel, mana, manaspent, soul, town_id, posx, posy, posz, cap, sex, redskull, blessing, stamina, losee_experience, loss_mana, loss_skills, loss_items, promotion) VALUES(" .. db.escapeString(Player_Name) .. ", 0, 0,".. Player_Account ..", ".. Player_Level ..", ".. Player_Vocation ..", ".. Player_Health ..", ".. Player_Health ..", ".. Player_Experience ..", 110, 0, ".. Player_Mag_Level ..", ".. Player_Mana ..", ".. Player_Mana.. ", 0, 0, ".. Player_Spawn_X ..", ".. Player_Spawn_Y ..", ".. Player_Spawn_Z ..", 400, ".. Player_Sex.. ", 0, 0, 10, 10, 10, 10, 0)")
end
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Last edited:
ahaha
Code:
elseif (msgcontains(msg, '[B]druid[/B]')) and talkState[talkUser] == 4 then
        selfSay('Awesome! A powerful [B]paladin[/B]. Let\'s get started with your account shall we? What would you like your account number to be?',cid)
 
Back
Top