Witam!
Robimy w Data/Npc/Scripts Manager.lua, a w nim:
Kod PHP:
---little config-----------------------------------------
templex = 160
templey = 54
templez = 7
maxnamelen = 20
maxpasslen = 20
startlvl = 8
startexp = 4200
vocations = 1
healthstart = 185
manastart = 35
depoitemid = 2591
promoted = 0
---little config-----------------------------------------
maxnamelen = 20
maxpasslen = 8
startlvl = 8
startexp = 4200
vocations = 1
healthstart = 185
manastart = 35
depoitemid = 2591
promoted = 1
---------skills-------------------------
--knight-------
kmlvl = 4
kfist = 10
kclub = 10
ksword = 10
kaxe = 10
kdist = 10
kshield = 10
kfish = 10
kcap = 100
--pall------------
pmlvl = 8
pfist = 10
pclub = 10
psword = 10
paxe = 10
pdist = 10
pshield = 10
pfish = 10
pcap = 10
---drut i sorc----
mmlvl = 15
mfist = 10
mclub = 10
msword = 10
maxe = 10
mdist = 10
mshield = 10
mfish = 10
mcap = 10
---end skills -------------------------------
---end little config-----------------------------------------
focus = 0
talk_start = 0
target = 0
following = false
attacking = false
accstatus = 0
seksik = 3
myname = ''
mypass = ''
allow_pattern = '^[a-zA-Z0-9 -]+$'
origmsg = ''
mypasscheck = ''
mynamecheck = ''
vocation = 0
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('Witaj. Jestem tu aby pomoc ci stworzyc nowe konto i nowa postac. --facet-- czy --kobieta-- (odpowiadaj po polsku) ')
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('Poczekaj, porozmawiam z toba za minutke')
elseif focus == cid then
talk_start = os.clock()
if accstatus == 1 then
if msgcontains(msg, 'facet') then selfSay('Facet?? OK, Podaj imie!')
seksik = 1
accstatus = 2
elseif msgcontains(msg, 'kobieta') then
selfSay('Kobieta?? Witamy w Gronie lasek Podaj Imie!')
seksik = 0
accstatus = 2
end
elseif accstatus == 66 then
if msgcontains(msg, 'paladin') then
vocation = 3
selfSay('Paladyn??, Jestes Pewny??')
elseif msgcontains(msg, 'sorcerer') then
vocation = 1
selfSay('Sorcerer??, Jestes Pewny??')
elseif msgcontains(msg, 'druid') then
vocation = 2
selfSay('Druid??, Jestes Pewny??')
elseif msgcontains(msg, 'knight') then
vocation = 4
selfSay('Knight??, Jestes Pewny??')
else
selfSay('Co tak mamroczesz, powiedz jeszcze raz.')
end
accstatus = 67
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('Chcesz miec na imie '..myname..' tak ?')
accstatus = 3
else
selfSay('To Imie jest uzywane, podaj inne!')
end
else
selfSay('To imie zawiera znaki inne niz cyfry lub litery! podaj inne imie!')
end
else
selfSay('To imie jest za dlugie, maksymalnie to 20 znakow')
end
elseif msgcontains(msg, 'tak') then
if accstatus == 3 then
if vocations == 0 then
selfSay('OK!!, Teraz podaj haslo jakie chcialbys miec.')
vocation = 0
accstatus = 4
else
selfSay('Oki, teraz podaj czy chcesz byc --paladin--, --sorcerer--, --druid-- czy --knight--.')
accstatus = 66
end
elseif accstatus == 5 then
if seksik == 0 then
selfSay('Ok, Teraz sprawdzmy, Jestes kobieta o nicku: '..myname..' haslo do twojego konta brzmi '..mypass..'. Numer zostanie wylosowany za chwile, wszystko sie zgadza??')
else
selfSay('Wspaniale. Sprawdzmy jeszcze raz: Jestes facetem o imieniu '..myname..' haslo do twojego konta brzmi '..mypass..'. Numer zostanie wylosowany na koncu. Czy wszystko sie zgadza ??')
end
accstatus = 6
elseif accstatus == 6 then
selfSay('Doskonale. Czy mozemy przystapic do losowania numeru? --losowanie-- --bye--')
accstatus = 7
elseif accstatus == 67 then
selfSay('Doskonale. Teraz powiedz jakie chcesz miec haslo.')
accstatus = 4
end
elseif msgcontains(msg, 'nie') then
if accstatus == 3 then
selfSay('Podaj inne, slucham')
accstatus = 2
elseif accstatus == 5 then
selfSay('Podaj inne, slucham')
accstatus = 4
elseif accstatus == 6 then
selfSay('Zacznijmy od poczatku: Jestes facetem czy kobieta --facet-- --kobieta--')
accstatus = 1
elseif accstatus == 67 then
selfSay('Ehhh wiec powiedz jeszcze raz - jaka profesje chcesz miec ?')
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('Twoje haslo bedzie brzmialo '..mypass..' tak ?')
accstatus = 5
else
selfSay('To haslo zawiera niedozwolone znaki !! Podaj inne')
end
else
selfSay('To haslo jest za dlugie !! Max to 8 znakow ! Podaj inne')
end
elseif msgcontains(msg, 'losowanie') and accstatus == 7 then
if manastart == 0 then
manastartc = 1
else
manastartc = manastart
end
if healthstart == 0 then
healthstartc = 1
else
healthstartc = healthstart
end
if vocations == 0 then
mlvl = 1
fist = 10
club = 10
sword = 10
axe = 10
dist = 10
shield = 10
fish = 10
cap = 100
else
if vocation == 1 or vocation == 2 then
mlvl = mmlvl
fist = mfist
club = mclub
sword = msword
axe = maxe
dist = mdist
shield = mshield
fish = mfish
cap = mcap
elseif vocation == 3 then
mlvl = pmlvl
fist = pfist
club = pclub
sword = psword
axe = paxe
dist = pdist
shield = pshield
fish = pfish
cap = pcap
elseif vocation == 4 then
mlvl = kmlvl
fist = kfist
club = kclub
sword = ksword
axe = kaxe
dist = kdist
shield = kshield
fish = kfish
cap = kcap
end
end
myaccnumber = math.random(100000,999999)
if io.open("data/accounts/"..myaccnumber..".xml" , "r") == nil then
selfSay('Oki, to tak: Twoj nick: '..myname..' Numer Konta: '..myaccnumber..' a haslo brzmi '..mypass..' Powiedz -next- aby zakonczyc rejestracje i bawic sie gra!! ~~By SpartaQs~~')
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=\"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.."\" id=\"" ..myaccnumber.."\" account=\""..myaccnumber.."\" sex=\""..seksik.."\" lookdir=\"2\" exp=\""..startexp.."\" voc=\""..vocation.."\" level=\""..startlvl.."\" access=\"0\" cap=\""..cap.."\" maglevel=\""..mlvl.."\" maxdepotitems=\"1000\" lastlogin=\"0\" lastlogout=\"0\" premmium=\"0\" promoted=\""..promoted.."\" soul=\"100\" warning=\"0\" red=\"0\" banTicks=\"0\" reason=\"\" rook=\"0\" sleeping=\"0\" knowaddon=\"0\" lookaddon=\"0\"><spawn x=\""..templex.."\" y=\""..templey.."\" z=\""..templez.."\"\/><temple x=\""..templex.."\" y=\""..templey.."\" z=\""..templez.."\"\/><health now=\""..healthstart.."\" max=\""..healthstartc.."\" food=\"0\"\/><mana now=\""..manastartc.."\" max=\""..manastartc.."\" spent=\"0\"\/><look type=\"128\" head=\"77\" body=\"79\" legs=\"78\" feet=\"77\"\/><guild name=\"\" rank=\"\" nick=\"\" id=\"\"/><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><ban comment=\"\" action=\"\"/><skull redskulltime=\"0\" redskull=\"0\"/><deaths\/><spells\/><inventory><slot slotid=\"3\"><item id=\"\"><\/inventory><depots><depot depotid=\"1\"><\/inside><\/item><\/depot><\/depots><storage/><viplist/><\/player>")
f:close()
r22 = math.random(10,99999)
h = io.open("./data/players/players.xml", "r")
h:read()
doop = h:read("*a")
h:close()
g = io.open("./data/players/players.xml", "w")
g:write("<players>\n<player guid=\""..r22.."\" name=\""..myname.."\"\/>\n"..doop.."\n")
g:close()
else
selfSay('Przepraszam, powiedz --losowanie-- jeszcze raz')
end
elseif msgcontains(msg, 'next') and accstatus == 8 then
selfSay('Numer: '..myaccnumber..' Haslo: '..mypass..'. by SpartaQs.')
accstatus = 0
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Dowidzenia, ' .. 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('Zapraszam Nowego!')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Do widzenia!')
focus = 0
end
end
end
Potem w
ots/npc dodajemy pliczek Acc Manager.xml i wklejamy:
Kod PHP:
<?xml version="1.0"?>
<npc name="Acc Manager" script="data/npc/scripts/manager.lua" access="3">
<look type="1448" head="57" body="59" legs="40" feet="76"/>
</npc>
Mamy Acc Managera i pokaze jeszce jak go ustawic!
Wchodzimy
ots/data/world/npc i wklejamy:
Kod PHP:
<npc name="Acc Manager" x="xxx" y="yyy" z="z" dir="2"/>
xxx- Pozycja x
yyy- Pozycja y
zzz- Pozycja z