• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Scrypt na pkt

Reins

Member
Joined
Apr 9, 2009
Messages
586
Reaction score
8
Posiadam scrypt na pkt od lvl, i mam taki problem.

Scrypt jest tylko na jeden lvl, tzn wbijesz 10 lvl dostajesz x pkt.

Jeżeli dodam ten sam scrypt pod inne storage na większy lvl to już pkt się nie dostaje.

w creaturescripts wygląda to tak

Code:
<event type="advance" name="Pointsforlevel" event="script" value="point10.lua"/>
<event type="advance" name="Pointsforlevel1" event="script" value="point15.lua"/>

Coś robię źle ?
 
Code:
local config = {
points=zzz,
storage=xxx,
level=yyy

}

function onAdvance(cid, skill, oldLevel, newLevel)

if(oldLevel<config.level and newLevel >=config.level) then
if(getPlayerStorageValue(cid,config.storage)==-1) then
local result_plr = db.getResult("SELECT * FROM accounts WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
local money = tonumber(result_plr:getDataInt("premium_points"))
money = money+config.points
db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Congratulations you have recived " .. config.points .." premium points.")
setPlayerStorageValue(cid,config.storage,1)
end
end

return true
end
 
LUA:
function onAdvance(cid, skill, oldLevel, newLevel)
local config = {
points=zzz,
storage=xxx,
level=yyy
}
    if(skill == 8 and newLevel >= config.level and getPlayerStorageValue(cid, config.storage) < 1) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HOLYAREA)
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Congratulations you have recived " .. config.points .." premium points.")
        db.executeQuery("UPDATE accounts SET premium_points = premium_points+".. config.points .." WHERE id IN (SELECT account_id FROM players WHERE name=".. getCreatureName(cid) ..");")
        setPlayerStorageValue(cid, config.storage, 1)
    end
    return true
end
 
Last edited:
Back
Top