sucibob
Member
- Joined
- Mar 28, 2017
- Messages
- 128
- Reaction score
- 13
Would be possible to add a storage and a addon to players offline?
That is my DB.sql
hastebin
I think storages are saved on: SELECT * FROM `player_storage`
So i did this, i think it gonna work:
db.executeQuery("INSERT INTO `player_storage` SET (`player_id`, `key`, `value`) VALUES ('" .. result.getDataInt(resultId2, "belongs_to") .. "', '" .. r.storage .. "', '" .. 1 .. "')")
It's right btw?
How the fuck it's save the players addon, i couldnt find it in no where
in players there is lookType, but i think that is the outfit player is using, not addon save stuff
How to add a addon for a player offline and a storage?
Full code:
---
btw- 2 things too:
1) How to change:
local requiredLevel = 15
if skill == SKILL_LEVEL and newLevel >= requiredLevel then
To lvl in r
I mean [50], [100], [150]
2) How should i change to have 3 rewards, not only one, because it set the value to 1, no add more one, and after add 1 time, its over to the others
That is my DB.sql
hastebin
I think storages are saved on: SELECT * FROM `player_storage`
So i did this, i think it gonna work:
db.executeQuery("INSERT INTO `player_storage` SET (`player_id`, `key`, `value`) VALUES ('" .. result.getDataInt(resultId2, "belongs_to") .. "', '" .. r.storage .. "', '" .. 1 .. "')")
It's right btw?
How the fuck it's save the players addon, i couldnt find it in no where
in players there is lookType, but i think that is the outfit player is using, not addon save stuff
How to add a addon for a player offline and a storage?
Full code:
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
local r = {
[50] = {premmydays = 1, storage = 50010},
[100] = {premmydays = 3, outfitid = 22, addon = 1},
[150] = {premmydays = 5, outfitid = 22, addon = 2},
}
local requiredLevel = 15
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 REWARD TO REFFERER
-- REWARD 1 storage
db.executeQuery("INSERT INTO `player_storage` SET (`player_id`, `key`, `value`) VALUES ('" .. result.getDataInt(resultId2, "belongs_to") .. "', '" .. r.storage .. "', '" .. 1 .. "')")
-- REWARD 2 addon 22,1
-- REWARD 3 addon 22,2
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
---
btw- 2 things too:
1) How to change:
local requiredLevel = 15
if skill == SKILL_LEVEL and newLevel >= requiredLevel then
To lvl in r
I mean [50], [100], [150]
2) How should i change to have 3 rewards, not only one, because it set the value to 1, no add more one, and after add 1 time, its over to the others
Last edited: