PDA

View Full Version : [KT] Xin script Giftcode nhập mã tại NPC hoạt động



kiemthe_dev
13-03-13, 01:13 AM
Pro nào có scripts Giftcode nhập mã code ở NPC để nhận đồ thì cho mình xin với nhé. Thanks!!!

omasa
13-03-13, 09:58 AM
Pro nào có scripts Giftcode nhập mã code ở NPC để nhận đồ thì cho mình xin với nhé. Thanks!!!

Mình ví dụ = file newplayergift.lua

Trong file đó có đoạn như dưới đây. Mình làm luôn 1 dạng cho bạn xem và tham khảo rồi làm tương tự với script khác (Mã nhận Girlcode là 123456 như bên dưới)



function tbGift:OnUse()
local nCurSec = Lib:GetDate2Time(tonumber(GetLocalDate("%Y%m%d")));
local nKaifuSec = KGblTask.SCGetDbTaskInt(DBTASD_SERVER_STARTTIME);
local nMinSec = math.min(nCurSec, nKaifuSec);
local nMaxSec = math.max(nCurSec, nKaifuSec);
local nItemId = it.dwId;
local nItemLevel = NewPlayerGift:GetCurrData(me);
local nIsHide = GM.tbGMRole:IsHide();
local szMsg = "<color=blue>Túi Tân Thủ <color>";
local tbOpt = {
{"<color=orange>Gift Code<color>",self.giftcode,self};
{"Ta Chỉ Xem Qua Thôi..."},
};
if nMaxSec <= Lib:GetDate2Time(self.WULINSHIJIA_ENDTIME) and nMinSec >= Lib:GetDate2Time(self. WULINSHIJIA_STARTTIME) then
end
Dialog:Say(szMsg, tbOpt);
end


function tbGift:giftcode()
Dialog:AskNumber("Nhập mã: ", 99999999999, self.admin12, self);
end


function tbGift:admin12(nCount)


local szMsg = "Ta có thể giúp gì cho ngươi";
local tbOpt = {};
if (nCount==123456) then
table.insert(tbOpt ,
{"<color=red>Nhận vật phẩm từ Gift Code<color>", self.nhanvp, self});
Dialog:Say(szMsg, tbOpt);
end
end

function tbGift:nhanvp()
me.AddItem(Cho item vào đây);
end




P/s: Code này mình chỉ làm theo hình thức tham khảo. Còn muốn nó chuẩn hơn theo ý bán thì bạn có thể thêm chức năng nhận 1 lần chẳng hạn hay gì gì đó v.v...

tuanmanhub
18-03-13, 05:18 PM
kiemthe_dev onl pm yh em nhé
30 charrrrrrrrrr