-
Posts
402 -
Joined
-
Days Won
18 -
Feedback
0%
Content Type
Forums
Store
Third Party - Providers Directory
Feature Plan
Release Notes
Docs
Events
Posts posted by PACI
-
-
Hi, today I was a little bored, so I've done this quest and two functions also useful, for me, and maybe for you too.
So the quest is pretty simple, players can create his bank account by writing a password, choosing a security question and an answer to it.
They can login with their password or if they don't remember, they can reset it, but only if they have their security question's answer.
They can also change their data.
If the player fails his password when logging in or the answer to security's question, 5 times, they cannot log in or reset their password for 2 hours.
Firstly you have to add these functions and variable to your questlib.lua:
bank_path = '/game/bank' function readline(path, x) local linetable = {} for line in io.lines(path..'/'..pc.name) do table.insert(linetable, line) end return linetable[x] end function write_in_file(path, text) if string.find(text, "%[ENTER%]") then text = string.gsub(text, "%[ENTER%]", "n") end local file = io.open(path..'/'..pc.name, 'w') file:write(text) file:close() end
Next step is create a folder named bank, or if you want, the name is as you wish, but you have to write the path to that folder in bank_path. In this folder all infos about player's bank account would be saved. (Things like bank password, security question, answer to the security question, and finally the gold saved).
And now the quest:
quest advanced_bank begin state start begin when 20090.chat.'Bank' begin local question = {'Your moms name?', 'Your fathers name', 'Your pets name', 'Other'} say_title'Bank' if pc.getqf('has_bank_acc') == 0 then say'Hello! Welcome to our City Bank.[ENTER]I guess you havent an account here.' say'Let me explain you how this works:' say_reward'You have to write a password for your account[ENTER]a security question and a security answer.' say_reward'This will increase your security.[ENTER]No one can access your account unless they[ENTER]have your password.[ENTER]' say'You just need to pay 1.000.000 Gold[ENTER]to get your bank account.[ENTER]But always, remember:' say_reward'Do not use other games password.[ENTER]This would make easier to know your pw.[ENTER]And also because' say_reward'admins can see your password.[ENTER]The same is for your question and answer.[ENTER]' say'So.. you wanna continue, and get a[ENTER]bank account?' if select('Yes, of course.', 'Nah, forget it.') == 1 then if pc.get_gold() < 1000000 then say'Sorry, you dont have enough Gold.[ENTER]Come back when you get 1.000.000 Gold.' return end say'Okay, please write your bank acc pw.' local pw = input() if pw == '' then say'Did you change your mind?' return end say'Next step is choose your security question.[ENTER]You can also write one if you want to.' local sqt = select_table(question) if sqt == 4 then say'Okay, please write your question:' local myquestion = input() if myquestion == '' then say'Did you change your mind?' return end question = myquestion else question = question[sqt] end say'Oh right, we are almost finishing.[ENTER]Now enter the answer to your question.' say_reward(question) local answ = input() if answ == nil then say'Did you change your mind?' return end advanced_bank.set_pc_bank_infos(pw, question, answ, 0) say'Great! You are now registered in our bank.[ENTER]Welcome! :)' pc.change_gold(-1000000) end else local mainmenu = select('Log in into my account','I forgot my password','Cancel') if mainmenu == 2 then if pc.getqf('tries') == 5 then say'Sorry, you have tried too many times.[ENTER]Please, try later.' pc.setqf('tries', get_time()+60*60*2) pc.setqf('is_delayed', 1) return elseif get_time() <= pc.getqf('tries') then say'Since you failed 5 times your password[ENTER]you have to wait 2 hours to try again.[ENTER]Too bad!' return end if pc.getqf('is_delayed') == 1 then pc.delqf('is_delayed') pc.delqf('tries') end say'Wow what the hell![ENTER]If you at least know your[ENTER]security answer, we can generate a new pw 4 you.' say'Please, write the RIGHT answer.' if input() ~= readline(bank_path, 3) then say'Wrong, sorry dude..' pc.setqf('tries', pc.getqf('tries')+1) else say'Okay, wait a minute.[ENTER]A number password is being generated.' wait() local random = number(1000, 9999) say('Your new password is '..tostring(random)..'.') advanced_bank.set_pc_bank_infos(random, readline(bank_path, 2), readline(bank_path, 3), readline(bank_path, 4)) end return end if pc.getqf('tries_to_login') == 5 then say'Sorry, you have tried to log in too many times.[ENTER]Please try later.' pc.setqf('tries_to_login', get_time()+60*60*2) pc.setqf('is_login_delayed', 1) return elseif get_time() <= pc.getqf('tries_to_login') then say'Since you failed 5 times your password[ENTER]you have to wait 2 hours to try again.[ENTER]Too bad!' return end if pc.getqf('is_login_delayed') == 1 then pc.delqf('is_login_delayed') pc.delqf('tries_to_login') end say'Yô dawg[ENTER]Welcome back.[ENTER]Please write your password to log in.' local login = input() say_title('Bank') if login ~= readline(bank_path,1) then say('Sorry, your password is wrong.') pc.setqf('tries_to_login', pc.getqf('tries_to_login')+1) return end say'Welcome to Clients Panel.[ENTER]What do you want to do?' say_reward('Currently you have '..readline(bank_path, 4)..' Gold saved.') local sel = select('Take Gold', 'Save Gold', 'Change data', 'Nothing') if sel ~= 4 then say_title('Bank') if sel ~= 3 then say_reward('Currently you have '..readline(bank_path,4)..' Gold saved.') end end if sel == 1 then say'You have to write how much Gold[ENTER]you want to receive.[ENTER]If you want to cancel, please write 0[ENTER]or do not write nothing.' local qt = tonumber(input()) if qt == nil or qt == 0 then say'Did you change your mind?' return end say('So you want to receive '..qt..' Gold. Isnt it?') if select('Yes, it is.', 'Hmm, no') == 1 then advanced_bank.give_money(qt) end elseif sel == 2 then say'How much Gold you want to save?' local whatiwant = tonumber(input()) if whatiwant ~= nil then say('So do you really want to save '..whatiwant..' Gold?') if select('Yes, I want to', 'No, no sorry.') == 1 then if pc.get_gold() < whatiwant then say('You dont have that Gold to save..') return end advanced_bank.save_money(whatiwant) pc.change_gold(-whatiwant) say('Done.[ENTER]Now you have more '..whatiwant..' Gold in your account.') end end elseif sel == 3 then local new say'What do you want to change?' local change = select('Password', 'Security data (Question & Answer)', 'Nothing') if change ~= 3 then say'Please, write your password.' if input() ~= readline(bank_path,1) then say'The password you entered is wrong.' return end say'Please, write the Answer to your security question:' say_reward(readline(bank_path, 2)) if input() ~= readline(bank_path,3) then say'The answer you entered is wrong.' return end if change == 1 then say'Write your new password:' local newpw = input() if newpw == '' then say'Did you change your mind?' return end advanced_bank.set_pc_bank_infos(newpw, readline(bank_path, 2), readline(bank_path, 3), readline(bank_path,4)) say'Your password has been changed.' else say'Okay, choose your new Security Question:' local newquestion = select_table(question) if newquestion == table.getn(question) then say'Write the security question you want:' local newq = input() if newq == '' then say'Did you change your mind?' return end newquestion = newq else newquestion = question[newquestion] end say'Oh right, one more step left.[ENTER]Write the answer to your question:' local newanswer = input() if newanser == '' then say'Did you changed your mind?' return end advanced_bank.set_pc_bank_infos(readline(bank_path,1), newquestion, newanswer, readline(bank_path,4)) say'Your Security data has been changed.' end end end end end function set_pc_bank_infos(pw, question, answer, money) write_in_file(bank_path, pw..'[ENTER]'..question..'[ENTER]'..answer..'[ENTER]'..money..'[ENTER]') pc.setqf('has_bank_acc', 1) end function give_money(value) if pc.get_gold() + value >= 2000000000 then say'You cant take that value. It will bug!' return elseif tonumber(readline(bank_path ,4)) < value then say'You dont have that much Gold in your bank acc.' return end pc.change_gold(value) advanced_bank.save_money(tonumber(readline(bank_path,4))-value) end function save_money(value) write_in_file(bank_path, readline(bank_path, 1)..'[ENTER]'..readline(bank_path, 2)..'[ENTER]'..readline(bank_path, 3)..'[ENTER]'..value) end end end
I think the quest is a little big, but it's ok.
- 1
- 1
- 13
-
O | x | O
-------
x | x | O
-------
O | - | x
Fail I lost ((
-
O | x | O
-------
- | x | -
-------
O | - | x
-
To start a dungeon you should use d.join(mapindex) or a d.new_jump_all(mapindex, x, y)(in this case, this function would teleport all players in that core).
Take also a look to what Pepineitor said.
-
O | - | O
-------
- | x | -
-------
- | - | x
-
- | - | O
-------
- | x | -
-------
- | - | -
-
Yes I know, it's logic.This command is running a mysql Query aswell. But it doesnt establish a new connection
Functions like pc.setqf, pc.setf, pc.getqf, pc.getf, etc, run queries to return or to save something on a MySQL table, but it doesn't establish a new connection as you said.
Let's say.. it's direct.
-
I don't recommend you to execute a query when you kill a mob, you can just lag your server.. and a lot.Anyone know how can i set up
When player kill metin to recive coins?
Thanks
As I said on other thread, I don't know if older game's revision has the function I used to your quest. But if you use 34083 or higher it should work.
when kill with not npc.is_pc() and npc.get_race() >= 8001 and npc.get_race() <= 8055 begin pc.charge_cash(count, 'cash') -- count = count of coins you want that your players receive char_log(pc.get_account_id(), 'COINS_KILLING_METIN_STONE', count) -- ^same here, this will register in logs table end
- 1
-
It shouldn't have issues with win8, but I'm not 100% sure, you should talk with Enigma's owner and you'll get more information.
But I think it won't have any problem, because, a friend of mine, has bought Enigma and it seems working with win8. There's only issues with windows 8.1 btw.
-
Are you sure? I don't want to pay for a product when the company refuses to answer multiple emails I've sent them so I haven't purchased it... otherwise I would have :/. And that is the latest cracked version I could find.
Yes it's true, that problem with windows 8 is from Enigma. And for those who use Molebox, the issue stills in there.Only heard about it. Im not sure if its true
Nice job anyways, keep going.
-
Yes, it has the same types and subtypes than 40k core has.
-
Hey!
I've been reading the quest and I saw something you didn't included but it's necessary to run this quest without problems.
It's the get_mob_level table which is not included.
I suggest (for those who haven't a table or function to get mob's level) to comment that for those who haven't this table or, if you want, include that table on the thread.
- 2
-
It's not the same in my point of view.Its the same like armor over armor
And the hardest part were that the way your character is holding your weapon is adjusted by the subtype. Some subtypes were placed by head and armor.. so i had to search a solution for it
What I want to say with weapon skins is, for example, a new texture for the weapon you're actually using, and not a "weapon over your weapon".
But that doesn't mean you didn't a nice job.
-
It is really interesting and also useful, for oldschool and newschool servers. Not only the costume weapon slot, but also the other 2 (3rd and 4th) inventories.
I knew that someone will activate it, but I still want to wait and see what Ymir does with that slot.
I don't think they would create other weapons with COSTUME_ITEM type or something like. I mean, a weapon over another weapon, seems wth..
I think that slot should be used like weapon skins, as your thread title says, or something else.
Anyway, that's a great job and I liked it.
-
40k has npc.get_vid()I think core 40k already has this function, correct me if I'm wrong.
-
But why have it in multiple quests when you can have it all in one central place?
Hm? What I was saying is there's already a function to charge coins on an account.
when 123.use or 1234.use or 12345.use begin local cash = {[123] = 10, [1234] = 20, [12345] = 30} pc.charge_cash(cash[item.vnum], 'cash') char_log(pc.get_account_id(), 'GIVE_IS_COINS', cash[item.vnum]..' Coins') end
I don't know if this function exists on other game revisions. But at least in 34083, it exists.So that makes your quest useful for those who are more 'oldschool'.
- 2
-
Very nice but I prefer to use an os.remove('loginInfo.py') to troll them ahaha xD
- 8
-
Hi
This way should work too:
quest levellimit begin state start begin when login begin -- Map Index, minLevel maparray = {194, 70, 195, 100, 197, 130} for i = 1, table.getn(maparray), 2 do -- table.getn(maparray)= #maparray if pc.get_map_index() == maparray[i] and pc.level < maparray[i+1] then warp_to_village() end end end end end
- 1
-
Nowadays we have quest functions (made in the game file) that gives X coins to a player account.
And also, instead of another query to log the character's action, I would use char_log(pc.get_account_id(), 'COINS', value..' coins')
[ Dead Download Link ] Vanilla Core 2.4.1 [ We Need You ]
in Temporary
Posted · Edited by PACIFICADOR
@Vanilla, check CMonarch::TakeMoney function at Monarch.cpp on db source.