sucibob
Member
- Joined
- Mar 28, 2017
- Messages
- 128
- Reaction score
- 13
Would be possible to add a storage and a addon to players offline?
I have this script base that adding donate points if player who was invited to play take lvl requiredLevel
Would be possible to add storages and addons?
I have this script base that adding donate points if player who was invited to play take lvl requiredLevel
Would be possible to add storages and addons?
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
local r = {
[25] = {premmydays = 1, storage = 50010},
[50] = {premmydays = 2, outfitid = 22, addon = 1},
[100] = {premmydays = 4, outfitid = 22, addon = 2},
}
local requiredLevel = 15
local bonusPoints = 5
if skill == SKILL_LEVEL and newLevel >= requiredLevel then
local accountId = getAccountId(cid)
-- Fetch the ref_key where account_id = accountId and blocked = 0
local resultId = db.storeQuery("SELECT `ref_key` FROM `__cornex_referral_actions` WHERE `registered_by` = " .. accountId .. " AND `blocked` = 0")
-- If result is found
if resultId ~= false then
-- Fetch the referrer's account_id based on ref_key from previous query result
local resultId2 = db.storeQuery("SELECT `belongs_to` FROM `__cornex_referral` WHERE `referral_key` = '" .. result.getDataString(resultId, "ref_key") .. "'")
-- If result is found
if resultId2 ~= false then
-- Update accountId's row blocked value to 1
db.executeQuery("UPDATE `__cornex_referral_actions` SET `blocked` = 1 WHERE `registered_by` = " .. accountId)
-- Update points to referrer
-- ADD ITEMS TO REFFERER
db.executeQuery("UPDATE `znote_accounts` SET `points` = (points + " .. bonusPoints .. ") WHERE `account_id` = '" .. result.getDataInt(resultId2, "belongs_to") .. "'")
result.free(resultId2)
else
print("Missing ref_key in `__cornex_referral` where ref_key = " .. result.getDataString(resultId, "ref_key"))
end
result.free(resultId)
end
end
return true
end