Jump to content

help! the script is not work!


Recommended Posts

script to change name with Vcoins with mysql!

gui_c.lua

 -- bam nút F5 để mở shop vcoin 
function F5(player,commandName) 
    bindKey(player,"F5","down",VcoinShopWindow) 
end 
addCommandHandler("bindme",F5) 
function unF5( player,commandName ) 
        unbindKey(player,"F5","down",VcoinShopWindow) 
     
end 
  
  
--bang shop Vcoins 
  
function VcoinShopWindow(theplayer) 
  
     
    local x=0.5 
    local x=0.5 
     
    local cao="100" 
    local rong="200" 
    bangshop = guiCreateWindow(x,y,rong,cao,"Vcoin Shop VnR",true) 
    nutdoiten = guiCreateButton(0.1,0.1,50,50,"đổi tên nhân vật",true,WindowShop) 
    guiSetVisible(VcoinShopWindow,false) 
  
    if (VcoinShopWindow ~=nil) then  
                    guiSetVisible(VcoinShopWindow,true) 
                    showCursor(true) 
            else   outputChatBox("không thể mở shop Vcoin, có lổi xảy ra, hãy liên hệ với admin Hy nhé.!",theplayer) 
     end 
  
    if (button="left" and state="up") then  
                                    guiSetVisible(bangshop,false) 
                else outputChatBox("lổi, hãy báo lại cho admin Hy",theplayer) end 
         
    addEventHandler("onClientGUIClick", nutdoiten, doiten,false) 
  
end 
  addCommandHandler("vcoinshop",root,VcoinShopWindow) 
  
  
-- bang doi ten 
function doiten(player,button,state) 
     
    bangdoiten = guiCreateWindow(0.5,0.5,100,50,"Nhập tên muốn đổi",true) 
    editdoiten = guiCreateEdit(0.5,0.5,25,25,"",true,bangdoiten) 
    giadoiten =  guiCreateLabel(0.5,0.35,20,20,"100Vcoins",bangdoiten) 
        guiEditSetMaxLength(editdoiten,255) 
    buttondoiten = guiCreateButton(0.5,0.5,20,15,"Đổi tên",true,bangdoiten) 
    guiSetVisible(bangdoiten,true)  
        guiSetInputEnabled(true) 
        showCursor(true) 
        if (button="left" and state="up") then showCursor(false) guiSetVisible(bangdoiten,false) 
         
            if editdoiten then triggerServerEvent("submitdoiten",getRootElement(),editdoiten)  
             
            outputChatBox("Đang xử lí") end 
                else outputChatBox("có lổi xảy ra trong quá trình xử lí đổi tên, hãy thông báo với admin Hy",player) end 
         
                                     
        else outputChatBox("lổi, hãy báo lại cho admin Hy",player) end 
    end 
end 
  
  

submit_s.lua

function batdaudoiten(editdoiten,theplayer) 
ketnoidatabase = dbConnect("mysql","dbname=db;host=localhost","root","","share=0") 
Vcoins = dbExec(ketnoidatabase,"SELECT*FROM accounts WHERE Vcoins") 
if (Vcoins>=100) then  
    local price = Vcoins - 100 
    layVcoins = dbExec(ketnoidatabase,"UPDATE ?? SET ?? = ?",accounts,Vcoins,price) 
    setname = dbExec(ketnoidatabase, "UPDATE ?? SET ?? = ?", characters, charactername,editdoiten) 
   if (layVcoins,setname) then outputChatBox("bạn đã đỏi tên thành công") end 
    else outputChatBox("có lổi xảy ra trong quá trình đổi tên, hãy báo lổi với admin Hy",theplayer) end 
    end 
else  
    outputChatBox("bạn không đủ Vcoins để đổi tên! hãy ra forums nạp Vcoins nhé",theplayer)  end 
     
end 
addHanler("submitdoiten",true) 
addEventHandler("submitdoiten",root,batdaudoiten) 

meta

<meta> 
    <info author="Hy" version="1.0.0" type="script" name="ShopVcoins" description="bán vật phẩm vip" /> 
    
    <script src="gui_c.lua" type="client" /> 
    <script src="submit_s.lua" type="server" /> 
    
    <!-- The Exports --> 
    <export function="query"/> 
    <export function="querySingle"/> 
    <export function="exec"/> 
    <export function="free"/> 
</meta> 

Link to comment
function batdaudoiten(editdoiten,theplayer) 
ketnoidatabase = dbConnect("mysql","dbname=db;host=localhost","root","","share=0") 
Vcoins = dbExec(ketnoidatabase,"SELECT*FROM accounts WHERE Vcoins") 
if (Vcoins>=100) then 
local price = Vcoins - 100 
layVcoins = dbExec(ketnoidatabase,"UPDATE ?? SET ?? = ?",accounts,Vcoins,price) 
setname = dbExec(ketnoidatabase, "UPDATE ?? SET ?? = ?", characters, charactername,editdoiten) 
if (layVcoins,setname) then  
outputChatBox("b?n dã d?i tên thành công") end 
else  
outputChatBox("có l?i x?y ra trong quá trình d?i tên, hãy báo l?i v?i admin Hy",theplayer)  
end 
else 
outputChatBox("b?n không d? Vcoins d? d?i tên! hãy ra forums n?p Vcoins nhé",theplayer)   
end 
    
  
addHanler("submitdoiten",true) 
addEventHandler("submitdoiten",root,batdaudoiten) 

Link to comment
function batdaudoiten(editdoiten,theplayer) 
ketnoidatabase = dbConnect("mysql","dbname=db;host=localhost","root","","share=0") 
Vcoins = dbExec(ketnoidatabase,"SELECT*FROM accounts WHERE Vcoins") 
if (Vcoins>=100) then 
local price = Vcoins - 100 
layVcoins = dbExec(ketnoidatabase,"UPDATE ?? SET ?? = ?",accounts,Vcoins,price) 
setname = dbExec(ketnoidatabase, "UPDATE ?? SET ?? = ?", characters, charactername,editdoiten) 
if layVcoins and setname then 
outputChatBox("b?n dã d?i tên thành công")  
end 
else 
outputChatBox("có l?i x?y ra trong quá trình d?i tên, hãy báo l?i v?i admin Hy",theplayer) 
end 
else 
outputChatBox("b?n không d? Vcoins d? d?i tên! hãy ra forums n?p Vcoins nhé",theplayer)   
end 
    
  
addHanler("submitdoiten",true) 
addEventHandler("submitdoiten",root,batdaudoiten) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...