-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResetSpells.lua
More file actions
28 lines (27 loc) · 1009 Bytes
/
Copy pathResetSpells.lua
File metadata and controls
28 lines (27 loc) · 1009 Bytes
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
local function OnPlayerLogin(event, player)
local pClass = player:GetClass();
local pGuid = player:GetGUIDLow();
Query = WorldDBQuery("SELECT prix, spellname, unlearn, classid, spellid, icon FROM spellvendor WHERE classid != "..pClass..";")
Check = CharDBQuery("SELECT refunded FROM characters WHERE guid = "..pGuid);
if(Check)then
local refunded = Check:GetUInt32(0);
if(refunded == 0)then
CharDBExecute("UPDATE characters SET refunded = 1 WHERE guid = "..pGuid);
if(Query) then
repeat
local refund = Query:GetUInt32(0);
local spellname = Query:GetString(1);
local unlearn = Query:GetUInt32(2);
local classid = Query:GetUInt32(3);
local spellid = Query:GetUInt32(4);
if(player:HasSpell(spellid))then
player:SendBroadcastMessage(spellname);
player:RemoveSpell(unlearn);
player:AddItem(3000002, refund)
end
until not Query:NextRow()
end
end
end
end
RegisterPlayerEvent( 3, OnPlayerLogin )