• 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!

Lua 8.6 ambiguous syntax (function call x new statement) near '('

Hernest

New Member
Joined
Jul 26, 2010
Messages
152
Reaction score
3
Location
poland
Code:
    if (str >= 10 and t1 == -1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 10 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
    (getPlayerStorageValue(cid, 35001) + 1)

Code:
[09/07/2014 01:56:46] [Error - LuaScriptInterface::loadFile] data/npc/scripts/taski.lua:39: ambiguous syntax (function call x new statement) near '('
[09/07/2014 01:56:46] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/taski.lua
[09/07/2014 01:56:46] data/npc/scripts/taski.lua:39: ambiguous syntax (function call x new statement) near '('

Without ' ( ) ' error is still here but another.
 
i think error in this line
Code:
(getPlayerStorageValue(cid, 35001) + 1)
and it said new statement
did u tried to put and ?
Code:
local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
and
    (getPlayerStorageValue(cid, 35001) + 1)
 
What is this part supposed to do?
Code:
(getPlayerStorageValue(cid, 35001) + 1)
Code:
  local t1 = getPlayerStorageValue(cid, 35001)
if (str >= 10 and t1 == -1) then
   npcHandler:say("Awesome! I gave you 5 premium points for your 10 tasks.")
   local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ")
   (getPlayerStorageValue(cid, 35001) + 1)
   elseif (t1 == 1) then
   npcHandler:say("You have already claimed reward!")

@edit

Whole code: http://wklej.org/id/1412682/
Code:
[09/07/2014 11:25:33] [Error - Npc interface]
[09/07/2014 11:25:33] data/npc/scripts/taski.lua
[09/07/2014 11:25:33] Description:
[09/07/2014 11:25:33] data/npc/scripts/taski.lua:19: attempt to concatenate a boolean value
[09/07/2014 11:25:33] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/taski.lua

[09/07/2014 11:25:33] [Error - Npc interface]
[09/07/2014 11:25:33] data/npc/scripts/taski.lua
[09/07/2014 11:25:33] Description:
[09/07/2014 11:25:33] (internalGetPlayerInfo) Player not found when requesting player info #19

[09/07/2014 11:25:33] [Error - Npc interface]
[09/07/2014 11:25:33] data/npc/scripts/taski.lua
[09/07/2014 11:25:33] Description:
[09/07/2014 11:25:33] (luaGetCreatureStorage) Creature not found
 
Last edited:
The creature not found error is because you used getPlayerStorageValue(cid, 2500) and the other storages outside any function.
This function uses the parameter cid and should be inside a function with that parameter. In this script it should be the function that is executed when talking to the npc, since the variables are used there.
~~~~
function creatureSayCallback(cid, type, msg)

local str = getPlayerStorageValue(cid, 2500)
~~~~

All variables with cid should be inside the function.
What is this part supposed to do?
Code:
(getPlayerStorageValue(cid, 35001) + 1)
The function getPlayerStorageValue returns a value, like 1, 2 etc. Besides that it gives a syntax error if you write it like this, having this randomly in your script does nothing.
It's like you just add for example 2 there.
 
for me it looks actually like you wanted to set the storagevalue to 1 or am I wrong?
if so then it should be:
Code:
setPlayerStorageValue(cid, 35001, 1)
if you however wanted to increase it by 1 then it would be this:
Code:
setPlayerStorageValue(cid, 35001, t1 + 1)
 
"Creature not found" is solved
_______________________
Code:
[09/07/2014 20:34:44] [Error - Npc interface]
[09/07/2014 20:34:44] data/npc/scripts/taski.lua
[09/07/2014 20:34:44] Description:
[09/07/2014 20:34:44] data/npc/scripts/taski.lua:14: attempt to concatenate a boolean value
[09/07/2014 20:34:44] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/taski.lua
Code:
    local points = query:getDataInt("premium_points")

Whole code: http://wklej.org/id/1412682/

And

Code:
[09/07/2014 20:34:44] [Error - Npc interface]
[09/07/2014 20:34:44] data/npc/scripts/taski.lua
[09/07/2014 20:34:44] Description:
[09/07/2014 20:34:44] (internalGetPlayerInfo) Player not found when requesting player info #19

Any ideas?
 
Can you post the script how it looks like now?
The script you posted still has cid outside/above function creatureSayCallback, everything with cid should be under/inside that function.
 
http://wklej.org/id/1413241/
Code:
local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}
    function onCreatureAppear(cid)    npcHandler:onCreatureAppear(cid)    end
    function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid)    end
    function onCreatureSay(cid, type, msg)    npcHandler:onCreatureSay(cid, type, msg)    end
    function onThink()    npcHandler:onThink()    end
    
    local storageKey = 343 -- // storage z taskow
    local taski = 10 -- // ilosc taskow
    local nagroda = 5 -- // ilosc pp za te 10 taskow
    local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
    local points = query:getDataInt("premium_points")
    local config = {
    -- // itemId = 2160, -- // item ktory npc odbiera
    -- // itemCount = 20, -- // ilosc tych itemow                // na taski to nie jest potrzebne :)
    -- // reward = {2348, 1} -- // nagroda, ilosc
    }
    function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
    end
    
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local str = getPlayerStorageValue(cid, 2500)
    local t1 = getPlayerStorageValue(cid, 35001)
    local t2 = getPlayerStorageValue(cid, 35002)
    local t3 = getPlayerStorageValue(cid, 35003)
    local t4 = getPlayerStorageValue(cid, 35004)
    if(msgcontains(msg, 'taski')) then
    npcHandler:say("za taski mozesz otrzymac pp suko")
    if(msgcontains(msg, 'premium points')) then
    -- // 10 taskow
    if (str >= 10 and t1 == -1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 10 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35001, 1)
    elseif (t1 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (str <= 9) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // 20 taskow
    if (str >= 20 and t2 == -1 and t1 == 1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 20 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35002, 1)
    elseif (t2 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (t1 == 1 and str <= 19) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // 30 taskow
    if (str >= 30 and t3 == -1 and t2 == 1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 30 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35003, 1)
    elseif (t3 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (t1 == 1 and t2 == 2 and str <= 29) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // 40 taskow
    if (str >= 40 and t4 == -1 and t3 == 1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 30 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35004, 1)
    elseif (t4 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (t1 == 1 and t2 == 2 and t3 == 3 and str <= 39) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // kurwa
   
   
   
    if(t1 == 10) then
    npcHandler:say("blabla shaelex krolem", cid)
    talkState[talkUser] = 1
    else
    npcHandler:say("blabla shaelex juz byl twoim krolem", cid)
    end
    elseif(msgcontains(msg, 'yes')) then
    if(talkState[talkUser] == 1) then
    npcHandler:say("", cid)
    else
    npcHandler:say("", cid)
    end
    end
    end
    return true
    end
    
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())
 
Code:
local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
local points = query:getDataInt("premium_points")
This part also uses cid.
 
Server logs is bugs free but it's did not work.
Code:
if(msgcontains(msg, 'taski')) then
    npcHandler:say("za taski mozesz otrzymac pp suko")
    if(msgcontains(msg, 'premium')) then
    if (str >= 10 and t1 == -1)...
When i said 'taski' it's ok, but when i said 'premium' nothing happend.

Full code:
http://wklej.org/id/1413241/
Code:
local keywordHandler = KeywordHandler:new()
    local npcHandler = NpcHandler:new(keywordHandler)
    NpcSystem.parseParameters(npcHandler)
    local talkState = {}
    function onCreatureAppear(cid)    npcHandler:onCreatureAppear(cid)    end
    function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid)    end
    function onCreatureSay(cid, type, msg)    npcHandler:onCreatureSay(cid, type, msg)    end
    function onThink()    npcHandler:onThink()    end
   
    local storageKey = 343 -- // storage z taskow
    local taski = 10 -- // ilosc taskow
    local nagroda = 5 -- // ilosc pp za te 10 taskow
    local query = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
    local points = query:getDataInt("premium_points")
    local config = {
    -- // itemId = 2160, -- // item ktory npc odbiera
    -- // itemCount = 20, -- // ilosc tych itemow                // na taski to nie jest potrzebne :)
    -- // reward = {2348, 1} -- // nagroda, ilosc
    }
    function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
    end
   
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local str = getPlayerStorageValue(cid, 2500)
    local t1 = getPlayerStorageValue(cid, 35001)
    local t2 = getPlayerStorageValue(cid, 35002)
    local t3 = getPlayerStorageValue(cid, 35003)
    local t4 = getPlayerStorageValue(cid, 35004)
    if(msgcontains(msg, 'taski')) then
    npcHandler:say("za taski mozesz otrzymac pp suko")
    if(msgcontains(msg, 'premium points')) then
    -- // 10 taskow
    if (str >= 10 and t1 == -1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 10 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35001, 1)
    elseif (t1 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (str <= 9) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // 20 taskow
    if (str >= 20 and t2 == -1 and t1 == 1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 20 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35002, 1)
    elseif (t2 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (t1 == 1 and str <= 19) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // 30 taskow
    if (str >= 30 and t3 == -1 and t2 == 1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 30 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35003, 1)
    elseif (t3 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (t1 == 1 and t2 == 2 and str <= 29) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // 40 taskow
    if (str >= 40 and t4 == -1 and t3 == 1) then
    npcHandler:say("Awesome! I gave you 5 premium points for your 30 tasks.")
    local update = db.executeQuery("UPDATE `accounts` SET `premium_points`= "..(points + nagroda).." WHERE `id`= " .. getPlayerAccountId(cid) .. "; ") and
    setPlayerStorageValue(cid, 35004, 1)
    elseif (t4 == 1) then
    npcHandler:say("You have already claimed reward!")
    elseif (t1 == 1 and t2 == 2 and t3 == 3 and str <= 39) then
    npcHandler:say("U do not have enough tasks to claim reward!")
    end
    -- // kurwa
  
  
  
    if(t1 == 10) then
    npcHandler:say("blabla shaelex krolem", cid)
    talkState[talkUser] = 1
    else
    npcHandler:say("blabla shaelex juz byl twoim krolem", cid)
    end
    elseif(msgcontains(msg, 'yes')) then
    if(talkState[talkUser] == 1) then
    npcHandler:say("", cid)
    else
    npcHandler:say("", cid)
    end
    end
    end
    return true
    end
   
    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())
 
That's because you have the msgcontains if statement for premium inside the msgcontains if statement for taski.
So it atm it should be both true at the same time, so someone should say taski and premium for the part after the if statement for premium to happen.
What you can do instead is using elseif.
Code:
if(msgcontains(msg, 'taski')) then
     npcHandler:say("za taski mozesz otrzymac pp suko")
elseif(msgcontains(msg, 'premium')) then
Then remove the end that closed "if(msgcontains(msg, 'premium')) then".
 
I know that i am annoying but
Code:
[23:22:24.144] [Error - NpcScript Interface]
[23:22:24.145] (Unknown script file)
[23:22:24.145] Description:
[23:22:24.145] attempt to call a nil value
[23:22:24.145] stack traceback:
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, 14)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)

function onTargetCreature(cid, target)
  if target then
  local outy = {10, 13, 28, 82, 276, 111, 332, 331, 292}
  local outfit = getCreatureOutfit(target)
  outfit.lookType = outy[math.random(1, #outy)]
  doSetCreatureOutfit(target, outfit, 30 * 1000)
     doSendMagicEffect(getCreaturePosition(cid), 1)
     
     if (outfit.lookType == 10) then
       doCreatureSay(cid, "BUTTERFLY, SHIT!", TALKTYPE_ORANGE_1)
     elseif (outfit.lookType == 13) then
         doCreatureSay(cid, "Bee...", TALKTYPE_ORANGE_1)
     elseif (outfit.lookType == 28) then
         doCreatureSay(cid, "Sss...", TALKTYPE_ORANGE_1)
     elseif (outfit.lookType == 82) then
         doCreatureSay(cid, "Slurp...", TALKTYPE_ORANGE_1)
     elseif (outfit.lookType == 276) then
         doCreatureSay(cid, "Meow...", TALKTYPE_ORANGE_1)
     elseif (outfit.lookType == 111) then
         doCreatureSay(cid, "Ko ko...", TALKTYPE_ORANGE_1)
  elseif (outfit.lookType == 292) then
         doCreatureSay(cid, "Wroah!!!", TALKTYPE_ORANGE_1)
  elseif (outfit.lookType == 331) then
         doCreatureSay(cid, "Live the Queen!", TALKTYPE_ORANGE_1)
  elseif (outfit.lookType == 332) then
         doCreatureSay(cid, "Live the King!", TALKTYPE_ORANGE_1)
     end
  end
  return true
end

setCombatCallback(combat, CALLBACK_PARAM_TARGETCREATURE, "onTargetCreature")

function onCastSpell(cid, var)
  return doCombat(cid, combat, var)
end
 
If your npc gives such errors, remove the npc and readd it. This won't be possible but you will get the error about what is actually wrong in your console.
 
Do not want to create new thread. It's almost done, just did not work correctly without errors in console.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid)                          npcHandler:onCreatureAppear(cid)                        end
function onCreatureDisappear(cid)                       npcHandler:onCreatureDisappear(cid)                     end
function onCreatureSay(cid, type, msg)                  npcHandler:onCreatureSay(cid, type, msg)                end
function onThink()                                      npcHandler:onThink()                                    end

    local storageKey = 343 -- // storage z taskow
    local taski = 10 -- // ilosc taskow
    local config = {
    points=5,
    storage=2500,

}
    function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
    end

    local idt = (getPlayerStorageValue (cid, 3543105) + getPlayerStorageValue (cid, 3543103) + getPlayerStorageValue (cid, 3543104) + getPlayerStorageValue (cid, 3543102) + getPlayerStorageValue (cid, 3543101) + getPlayerStorageValue (cid, 3543100) + getPlayerStorageValue (cid, 3543099) + getPlayerStorageValue (cid, 3543098) + getPlayerStorageValue (cid, 3543097) + getPlayerStorageValue (cid, 3543096) + getPlayerStorageValue (cid, 3543094) + getPlayerStorageValue (cid, 3543095) + getPlayerStorageValue (cid, 3543093) + getPlayerStorageValue (cid, 3543092) + getPlayerStorageValue (cid, 3543091) + getPlayerStorageValue (cid, 3543090) + getPlayerStorageValue (cid, 3543089) + getPlayerStorageValue (cid, 3543086) + getPlayerStorageValue (cid, 3543087) + getPlayerStorageValue (cid, 3543088) + getPlayerStorageValue (cid, 3543085) + getPlayerStorageValue (cid, 3543084) + getPlayerStorageValue (cid, 3543083) + getPlayerStorageValue (cid, 3543081) + getPlayerStorageValue (cid, 3543082) + getPlayerStorageValue (cid, 3543080) + getPlayerStorageValue (cid, 3543077) + getPlayerStorageValue (cid, 3543078) + getPlayerStorageValue (cid, 3543079) + getPlayerStorageValue (cid, 3543075) + getPlayerStorageValue (cid, 3543076) + getPlayerStorageValue (cid, 3543074) + getPlayerStorageValue (cid, 3543070) + getPlayerStorageValue (cid, 3543071) + getPlayerStorageValue (cid, 3543072) + getPlayerStorageValue (cid, 3543073) + getPlayerStorageValue (cid, 3543069) + getPlayerStorageValue (cid, 3543068) + getPlayerStorageValue (cid, 3543067) + getPlayerStorageValue (cid, 3543066) + getPlayerStorageValue (cid, 3543064) + getPlayerStorageValue (cid, 3543065) + getPlayerStorageValue (cid, 3543035) + getPlayerStorageValue (cid, 3543036) + getPlayerStorageValue (cid,3543037) + getPlayerStorageValue (cid, 3543038) + getPlayerStorageValue (cid, 3543039) + getPlayerStorageValue (cid, 3543040) + getPlayerStorageValue (cid, 3543041) + getPlayerStorageValue (cid, 3543042) + getPlayerStorageValue (cid, 3543043) + getPlayerStorageValue (cid, 3543044) + getPlayerStorageValue (cid, 3543045) + getPlayerStorageValue (cid, 3543047) + getPlayerStorageValue (cid, 3543046) + getPlayerStorageValue (cid, 3543048) + getPlayerStorageValue (cid, 3543049) + getPlayerStorageValue (cid, 3543050) + getPlayerStorageValue (cid, 3543059) + getPlayerStorageValue (cid, 3543056) + getPlayerStorageValue (cid, 3543053) + getPlayerStorageValue (cid, 3543052) + getPlayerStorageValue (cid, 3543063) + getPlayerStorageValue (cid, 3543062))





    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local t1 = getPlayerStorageValue(cid, 35001)
    local t2 = getPlayerStorageValue(cid, 35002)
    local t3 = getPlayerStorageValue(cid, 35003)
    local t4 = getPlayerStorageValue(cid, 35004)
    local t5 = getPlayerStorageValue(cid, 35005)
    if(msgcontains(msg, 'tasks')) then
    npcHandler:say("If you want to get premium points, you need to do 10 task first. For every 10 tasks I can give you {premium points}.", cid)
    elseif(msgcontains(msg, 'premium points')) then
    if (idt >= 10 and t1 == -1) then
    local result_plr = db.getResult("SELECT * FROM accounts WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
    local money = tonumber(result_plr:getDataInt("premium_points"))
    npcHandler:say("Awesome! I gave you " .. config.points .. " for your 10 tasks.", cid)
        db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
    money = money+config.points
    setPlayerStorageValue(cid, 35001, 1)
    elseif (t1 == 1 and t2 == -1) then
    npcHandler:say("You have already claimed reward!", cid)
    elseif (idt <= 9) then
    npcHandler:say("U do not have enough tasks to claim reward!", cid)
    end
    -- // 20 taskow
    if (idt >= 20 and t2 == -1 and t1 == 1) then
    npcHandler:say("Awesome! I gave you " .. config.points .. " for your 20 tasks.", cid)
        db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
    setPlayerStorageValue(cid, 35002, 1)
    elseif (t2 == 1 and t3 == -1) then
    npcHandler:say("You have already claimed reward!", cid)
    elseif (t1 == 1 and idt <= 19) then
    npcHandler:say("U do not have enough tasks to claim reward!", cid)
    end
    -- // 30 taskow
    if (idt >= 30 and t3 == -1 and t2 == 1) then
    npcHandler:say("Awesome! I gave you " .. config.points .. " for your 30 tasks.", cid)
        db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
    setPlayerStorageValue(cid, 35003, 1)
    elseif (t3 == 1) then
    npcHandler:say("You have already claimed reward!", cid)
    elseif (t1 == 1 and t2 == 1 and idt <= 29) then
    npcHandler:say("U do not have enough tasks to claim reward!", cid)
    end
    -- // 40 taskow
    if (idt >= 40 and t4 == -1 and t3 == 1) then
    npcHandler:say("Awesome! I gave you " .. config.points .. " for your 40 tasks.", cid)
        db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
    setPlayerStorageValue(cid, 35004, 1)
    elseif (t4 == 1) then
    npcHandler:say("You have already claimed reward!", cid)
    elseif (t1 == 1 and t2 == 1 and t3 == 1 and idt <= 39) then
    npcHandler:say("U do not have enough tasks to claim reward!", cid)
    end
    -- // 50 tasks
    if (idt >= 50 and t5 == -1 and t4 == 1) then
    npcHandler:say("Awesome! I gave you " .. config.points .. " for your 40 tasks.", cid)
        db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
    setPlayerStorageValue(cid, 35005, 1)
    elseif (t5 == 1) then
    npcHandler:say("You have already claimed reward!", cid)
    elseif (t1 == 1 and t2 == 1 and t3 == 1 and t4 == 1 and idt <= 39) then
    npcHandler:say("U do not have enough tasks to claim reward!", cid)
    end
    -- // 60 tasks
    if (idt >= 60 and t6 == -1 and t5 == 1) then
    npcHandler:say("Awesome! I gave you " .. config.points .. " for your 40 tasks.", cid)
        db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. money .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
    setPlayerStorageValue(cid, 35006, 1)
    elseif (t6 == 1) then
    npcHandler:say("You have already claimed reward!", cid)
    elseif (t1 == 1 and t2 == 1 and t3 == 1 and t4 == 1 and t5 == 1 and idt <= 39) then
    npcHandler:say("U do not have enough tasks to claim reward!", cid)
    end
    -- // kurwa

    if(t1 == 10) then
    talkState[talkUser] = 1
    end
    elseif(msgcontains(msg, 'yes')) then
    if(talkState[talkUser] == 1) then
    else
    end
    end
    return true
    end

    npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
    npcHandler:addModule(FocusModule:new())

I have got 12 tasks but still 19:52 John: U do not have enough tasks to claim reward!

local idt
if (idt >= 10 and t1 == -1) then

important ^

found error, many storages got -1 at the beggining..

there is a way to do smth like
local idt = (getPlayerStorageValue (cid, 3543105) + getPlayerStorageValue (cid, 3543103) +..
if (getPlayerStorageValue (cid, 3543105) == 1 )then
insert into 'idt' "getPlayerStorageValue (cid, 3543105) +" (????)
 
Last edited:
Are the storage numbers correct?
You can add
Code:
print(idt)
This will show the number in console.

If players doesn't have a storage yet, it will be -1, so this is normal.
 
Code:
  if(msgcontains(msg, 'tasks')) then
   npcHandler:say("If you want to get premium points, you need to do 10 task first. For every 10 tasks I can give you {premium points}.", cid)
   print (idt)
  if(msgcontains(msg, 'tasks')) then
   npcHandler:say("If you want to get premium points, you need to do 10 task first. For every 10 tasks I can give you {premium points}.", cid) and
   print (idt)

made error lol, without print it is ok

ok i got it, error with space


@edit

20:59 Eryn: You have done -64 tasks. If you want to get premium points, you need to do 10 task first. For every 10 tasks I can give you premium points.

There is any way to add storagevalue to variable when that value == 1?
 
Last edited:
You can use a for loop to count the storages.
Code:
local n = 0
for x = 3543062, 3543105 do
     if getPlayerStorageValue(cid, x) >= 1 then
         n = n + 1
     end
end

if n >= 10 then
 
[Error - LuaInterface::loadFile] data/npc/scripts/tescik.lua:19: 'do' expected near ',' [23:52:38.168] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/tescik.lua [23:52:38.168] data/npc/scripts/tescik.lua:19: 'do' expected near ','

Code:
    local n = 0 -- liczba tasków
        for x = 3543105,3543103,3543104,3543102,3543101,3543100,3543099,3543098,3543097,3543096,3543094,3543095,3543093,3543092,3543091,3543090,3543089,3543086,3543087,3543088,3543085,3543084,3543083,3543081,3543082,3543080,3543077,3543078,3543079,3543075,3543076,3543074,3543070,3543071,3543072,3543073,3543069,3543068,3543067,3543066,3543064,3543065,3543035,3543036,3543037,3543038,3543039,3543040,3543041,3543042,3543043,3543044,3543045,3543047,3543046,3543048,3543049,3543050,3543059,3543056,3543053,3543052,3543063,3543062 do
            if getPlayerStorageValue(cid, x) >= 1 then
         n = n + 1
        end
    end
    function creatureSayCallback(cid, type, msg)
    if(not npcHandler:isFocused(cid)) then
    return false
    end
 
Back
Top