• Страница 1 из 1
  • 1
Модератор форума: Dimitro  
[LUA] Account/Player Manager
LOrdas
ƉỜṪḀ ƇǒӎӎɥȠȊțy
It's called Account and Player Manager, a little NPC writed in Lua, with some SQL QUERY, who will give you the possibility to change :
- Your login name.
- Your account's password.
- Your character's name.
- Your character's gender.

You will need to enable the Character DB Queries in your optional config.

An amazing little script for your players, an AccManager in game.

Code
--[[  
Account/Player Manager InGame  
Script by  Dr. Cheasterfield  
Please do not leech, or post on an other board.
--]]

local AccMan.NPC_ID = 99999

--[[
SQL QUERY SETTINGS DO NOT TOUCH !
--]]

local PLR-IN = player:GetName()
local Plr_IDAcc = CharDBQuery("SELECT acct FROM characters WHERE name = '"..PLR-IN.."'", 0)
local Plr_NAMEAcc = CharDBQuery("SELECT login FROM accounts WHERE acct = '"..Plr_IDAcc.."'", 0)
local Plr_PASSWORDAcc = CharDBQuery("SELECT password FROM accounts WHERE acct = '"..Plr_IDAcc.."'", 0)
local Verif_Name = CharDBQuery("SELECT login FROM accounts WHERE login ='"..code.."'", 0)
local Verif_Plr.Name = CharDBQuery("SELECT name FROM characters WHERE name ='"..code.."'", 0)
local Plr_Gender = player:GetGender()

--[[
Events
--]]

function AccMan_Gossip(pUnit, event, player)
         if (player:IsInCombat() == true) then
             player:SendAreaTriggerMessage("You are in combat!")
         else
             pUnit:GossipCreateMenu(50, player, 0)
             pUnit:GossipMenuAddItem(0, "Manage your Account.", 1, 1)  
             pUnit:GossipMenuAddItem(0, "Manage your Player ["..PLR-IN.."].", 2, 1)
             pUnit:GossipMenuAddItem(0, "Leave", 3, 0)
             pUnit:GossipSendMenu(player)
         end
  end

function AccMan_Actions(pUnit, event, player, id, intid, code)
         if (intid == 1) then
         -- Account Manage options
         pUnit:GossipCreateMenu(50, player, 0)
         pUnit:GossipMenuAddItem(0, "Change your Accountname.", 4, 1)
         pUnit:GossipMenuAddItem(0, "Change your Password.", 5, 1)  
         pUnit:GossipMenuAddItem(0, "Leave", 3, 0)
         pUnit:GossipSendMenu(player)         
         end
          
         if (intid == 2) then
         -- Player Manage options
         pUnit:GossipCreateMenu(50, player, 0)
         pUnit:GossipMenuAddItem(0, "Change your Name.", 6, 1)
             if (Plr_Gender == 0) then
             pUnit:GossipMenuAddItem(0, "Become a FEMALE.", 7, 1)  
             else
             pUnit:GossipMenuAddItem(0, "Become a MALE.", 7, 1)
             end
         pUnit:GossipMenuAddItem(0, "Leave", 3, 0)
         pUnit:GossipSendMenu(player)         
         end
                      
         if (intid == 3) then
         -- Leave Gossip  
         player:GossipComplete(player)
         end
          
         if (intid == 4) then
         -- Login Manage
         if (Verif_Name == code) then
             player:SendBroadcastMessage("Login already used !")
             player:GossipComplete()     
         else
             CharDBQuery("UPDATE accounts SET login = '"..code.."' WHERE acct = '"..Plr_IDAcc.."'", 0)
             player:SendBroadcastMessage("Your login ["..Plr_NAMEAcc.."] is succesfully changed to ["..code.."]. It will take effect after your next connection.")
             player:GossipComplete()
         end
         end
          
         if (intid == 5)
         -- Password Manage
         CharDBQuery("UPDATE accounts SET password = '"..code.."' WHERE acct = '"..Plr_IDAcc.."'", 0)
         player:SendBroadcastMessage("Your password ["..Plr_PASSWORDAcc.."] is succesfully changed to ["..code.."]. It will take effect after your next connection.")
         player:GossipComplete()
         end
          
         if (intid == 6)
         -- Character Name Manage
         if (Verif_Plr.Name == code) then
             player:SendBroadcastMessage("Name already used !")
             player:GossipComplete()     
         else
             CharDBQuery("UPDATE characters SET name = '"..code.."' WHERE acct = '"..Plr_IDAcc.."'", 0)
             player:SendBroadcastMessage("Your character's name ["..PLR_IN.."] is succesfully changed to ["..code.."]. It will take effect after your next connection.")
             player:GossipComplete()
         end
          
         if (intid == 7)
             if (Plr_Gender == 0) then
             player:SetGender(1)
             player:SendBroadcastMessage("Your character's gender is succesfully changed to FEMALE. It will take effect after your next connection.")
             player:GossipComplete()
             else
             player:SetGender(0)
             player:SendBroadcastMessage("Your character's gender is succesfully changed to MALE. It will take effect after your next connection.")
             player:GossipComplete()
         end
     end
          
RegisterUnitGossipEvent(AccMan.NPC_ID, 1, "AccMan_Gossip")
RegisterUnitGossipEvent(AccMan.NPC_ID, 2, "AccMan_Actions")

Думаю понятно что это менеджер вашего игрового аккаунта.
Тема автора

Сообщение # 1 написано 21.09.2010 в 04:14
  • Страница 1 из 1
  • 1
Поиск: