[R]Character Swap 2.0

08/12/2013 12:57 HaveBeen™#1




Hi Guys :pimp:
Quest:

PHP Code:
----------------------------------------------------------
--- 
Character Swap System
--- HaveBeen™ - NRY WORK
--- www.elitepvpers.com
----------------------------------------------------------
quest swap begin
    state start begin
        
function load_settings()
            
local data = {
                {}
            }
            
data.Settings = {activate 1,get_time 86400,minimum_level 50maximum_level 105,Use_To_GM false}
            return 
data
        end
        
function swap(sname,name)
            
local find find_pc_by_name(sname)
            
local old pc.select(find)
            
local id pc.get_account_id()
            
pc.select(old)
            
local data swap.load_settings()
            
local s mysql_query("select * from account.account where id = '"..id.."'")
            
local m mysql_query("select * from account.account where id = '"..pc.get_account_id().."'")
            
data.Sname = {accountname s.login[1],password s.password[1]}
            
data.My = {accountname m.login[1],password m.password[1]}
            
mysql_query("update from account.account password = '"..data.Sname.password.."' where id = '"..pc.get_account_id().."'")
            
mysql_query("update from account.account password = '"..data.My.password.."' where id = '"..id.."' ")
            
local x pc.select(find)
                
say_title("Information:")
                
say("")
                ---
                
say("Accountname: "..data.My.accountname)
                
say("")
                
say_reward("Your password is same.")
                
say_reward("Thanks. Good day!")
                
pc.setqf("time",get_global_time())
                
command("quit")
            
pc.select(x)
            
say_title("Information:")
            
say("")
            ---
            
say("Accountname: "..data.Sname.accountname)
            
say("")
            
say_reward("Your password is same.")
            
say_reward("Thanks. Good day!")
            
pc.setqf("time",get_global_time())
            
command("quit")
        
end
        when 9006.chat
."Character Swap" begin
            say_title
(mob_name(npc.get_race())..":")
            
say("")
            ---
            
local data swap.load_settings()
            if(
pc.is_gm() and data.Settings.Use_To_GM == falsethen
                say_reward
("You don't use to this system.")
                return
            elseif(
data.Settings.get_time get_global_time() - pc.getqf("time")) then
                say_reward
("Unfortunately you can't swap characters.")
                
say_reward("")
                return
            elseif(
not pc.get_level() > data.Settings.minimum_level and not pc.get_level() <= data.Settings.maximum_levelthen
                say_reward
("You can't swap characters.")
                
say_reward("Level isn't enough / "..data.Settings.maximum_level.." levels is higher for.")
return
end
            say
("Enter name of your character swap.")
            
say("")
            
local sname input()
            
local find find_pc_by_name(sname)
            
say_title(mob_name(npc.get_race())..":")
            
say("")
            --
            if(
sname == "" or tostring(sname) == nilthen
                say_reward
("You need to write a name.")
                
say_reward("If you don't , you can't swap characters.")
            elseif(
find == 0then
                say_reward
("This person is someone that isn't open or doesn't exists.")
                
say_reward("")
                return
            
end
            say
("Please wait while request is being transmitted.")
            
say("")
            
local agree confirm(find,"Do you want to swap with "..pc.name.." character",30)
            
say_title(mob_name(npc.get_race())..":")
            
say("")
            --
            if(
agree != CONFIRM_OKthen
                say
(sname.." didn't accept your request.")
                
say("")
                return
            
end
            swap
.swap(sname,pc.name)
        
end
    end
end 
Questlib:

PHP Code:
function split(strdelimmaxNb)  
    if 
str == nil then return str end  
    
if string.find(strdelim) == nil then return { str end  
    
if maxNb == nil or maxNb 1 then maxNb 0 end  
    local result 
= {}  
    
local pat "(.-)" .. delim .. "()"  
    
local nb 0  
    local lastPos  
    
for partpos in string.gfind(strpat) do  
        
nb nb 1  
        result
[nb] = part  
        lastPos 
pos  
        
if nb == maxNb then break end  
    end  
    
if nb ~= maxNb then result[nb 1] = string.sub(strlastPosend  
    
return result  
end  



mysql_query 
= function(query)  
    
local rt io.open('CONFIG','r'):read('*all')  
    
local prestring.gsub(rt,'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+','-h%1 -u%2 -p%3 -D%4')  
    
math.randomseed(os.time())  
    
local fi,t,out 'mysql_data_'..math.random(10^9)+math.random(2^4,2^10),{},{}  
    
os.execute('mysql '..pre..' --e='..string.format('%q',query)..' > '..fi)    
    for 
av in io.open(fi,'r'):lines() do table.insert(t,split(av,'\t')) endos.remove(fi);  
    for 
2table.getn(t) do table.foreach(t[i],function(a,b)  
        
out[i-1]        = out[i-1] or {}  
        
out[i-1][a]        = b  
        out
[t[1][a]]    = out[t[1][a]] or {}  
        
out[t[1][a]][i-1]    = b  
    end
end  
    
return out  
end 

Mfg HaveBeen™
King Regards



08/12/2013 13:31 MartPwnS#2
What does it do sry i didnt Get it.
08/12/2013 13:49 Summex#3
Quote:
Originally Posted by MartPwnS View Post
What does it do sry i didnt Get it.
I think it is a system to give your friend your character when you stop playing or but you don't want to give him the full acount with the password and everything.

-

Ich denke es ist ein System um z.B. einem Freund seinen Charakter rüberzu "tauschen" ohne ihm dafür den ganzen Account mit Passwort usw. zu geben.
08/12/2013 14:20 Nunuh91#4
It's a quest to swap characters is that hard to understand?
Swap = Trade
Trade Chars with other account!