-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVipBox.lua
More file actions
85 lines (79 loc) · 2.97 KB
/
Copy pathVipBox.lua
File metadata and controls
85 lines (79 loc) · 2.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
local commande = {};
local RogueStealth = 1787;
local RacialStealth = 20580;
local DruidStealth = 9913;
function commande.vipbox (event, player, command)
if (command == "vipbox") then
local pAccount = player:GetAccountName();
local pName = player:GetName();
local pGuid = player:GetGUIDLow();
local pAccId = player:GetAccountId();
if( PlayerIsVIP(pAccId) == false)then
return false;
end
Query1 = AuthDBQuery("SELECT vip FROM account WHERE id = " .. pAccId .. ";");
if(Query1) then
if(Query1:GetUInt32(0) ~= 0) then
isVIP = Query1:GetUInt32(0);
end
end
if(isVIP == 1)then
Query2 = CharDBQuery("SELECT vipbox FROM characters WHERE guid = " .. pGuid .. ";");
if(Query2) then
if(Query2:GetUInt32(0) == 0) then
local Query3 = CharDBExecute("UPDATE characters SET vipbox = 1 WHERE guid = " .. pGuid .. ";");
local QueryItem = WorldDBQuery("SELECT entry FROM item_template WHERE entry BETWEEN 3000000 AND 7000306 OR entry BETWEEN 90000 AND 94004 ORDER BY RAND() LIMIT 1;");
local iadd = QueryItem:GetUInt32(0);
player:AddItem(iadd, 1);
player:SendBroadcastMessage("Vous avez ouvert vote box.");
else
player:SendBroadcastMessage("Vous avez déjà ouvert votre vip box aujourd'hui, attendez 22h00 pour la ré-ouvrir.");
end
end
else
player:SendBroadcastMessage("Il vous faut posséder un compte VIP afin d'éxecuter cette commande.");
return false;
end
return false;
end
end
function commande.premiumbox (event, player, command)
if (command == "premiumbox") then
local pAccount = player:GetAccountName();
local pName = player:GetName();
local pGuid = player:GetGUIDLow();
local pAccId = player:GetAccountId();
if( PlayerIsVIP(pAccId) == false)then
return false;
end
Query1 = AuthDBQuery("SELECT premium FROM account WHERE id = " .. pAccId .. ";");
if(Query1) then
if(Query1:GetUInt32(0) ~= 0) then
isPremium = Query1:GetUInt32(0);
end
end
if(isPremium == 1)then
Query2 = CharDBQuery("SELECT premiumbox FROM characters WHERE guid = " .. pGuid .. ";");
if(Query2) then
if(Query2:GetUInt32(0) == 0) then
local Query3 = CharDBExecute("UPDATE characters SET premiumbox = 1 WHERE guid = " .. pGuid .. ";");
local QueryItem = WorldDBQuery("SELECT entry FROM item_template WHERE entry BETWEEN 3000000 AND 7000306 OR entry BETWEEN 90000 AND 94004 ORDER BY RAND() LIMIT 1;");
local iadd = QueryItem:GetUInt32(0);
player:AddItem(iadd, 1);
player:SendBroadcastMessage("Vous avez ouvert vote box.");
else
player:SendBroadcastMessage("Vous avez déjà ouvert votre premium box cette semaine, attendez lundi 22h00 pour la ré-ouvrir.");
end
end
else
player:SendBroadcastMessage("Il vous faut posséder un compte premium afin d'éxecuter cette commande.");
return false;
end
return false;
end
end
RegisterPlayerEvent(42, commande.vipbox);
RegisterPlayerEvent(42, commande.premiumbox);
-- ListFile
local console = debug.getinfo (1, "S").short_src;
print("- "..console);