Skip to content

Commit

Permalink
Send only data if correct result
Browse files Browse the repository at this point in the history
  • Loading branch information
ramon-bernardo committed Nov 4, 2024
1 parent 49e7ca7 commit d7e1c06
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions data/lib/core/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -820,16 +820,20 @@ function Player.addVip(self, name)

local accountId = self:getAccountId()
db.asyncQuery("INSERT INTO `account_viplist` (`account_id`, `player_id`) VALUES (" .. accountId .. ", " .. vipGuid .. ")", function(result)
playerVip:add(vipGuid)
self:sendVip(vipGuid, vipName, description, icon, notify, status)
if result then
playerVip:add(vipGuid)
self:sendVip(vipGuid, vipName, description, icon, notify, status)
end
end)
end

function Player.removeVip(self, vipGuid)
local accountId = self:getAccountId()
db.asyncQuery("DELETE FROM `account_viplist` WHERE `account_id` = " .. accountId .. " AND `player_id` = " .. vipGuid, function(result)
local playerVip = Vip(self:getGuid())
playerVip:remove(vipGuid)
if result then
local playerVip = Vip(self:getGuid())
playerVip:remove(vipGuid)
end
end)
end

Expand Down

0 comments on commit d7e1c06

Please sign in to comment.