Otfan125
Well-Known Member
TFS VERSION: 1.3
Hey guys,
so this question is related to the previous two which I have posted and has to do with the function "storeQuery"... Check this out:
I have here a small piece of code that executes the function "storeQuery", which is suppose to retrieve the value found in column 'blademaster' in 'players' for player=Angel. Note that this works fine the first time Angel logs in the game (i.e., res=1, verified with the print statement). Now, if Angel logs out of the game and back in, res actually returns plus one more than the previous log in (i.e., second time res=2, third time res=3, etc.) I've tried the following:
which simply avoids using "local res", though this doesn't work for the same reason (I think).
It seems that every time storeQuery is called, it adds to some global variable that is hidden somewhere... Is there perhaps a "delete" or "free" function that resets the storeQuery global variable (if any)?
Hey guys,
so this question is related to the previous two which I have posted and has to do with the function "storeQuery"... Check this out:
Lua:
function onLogin(player)
local res = db.storeQuery("SELECT `blademaster` FROM `players` WHERE `name` = \"Angel\";")
print(res)
if res == 1 then
print("test")
local condition = Condition(CONDITION_BLADEMASTER)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
player:addCondition(condition)
end
return true
end
I have here a small piece of code that executes the function "storeQuery", which is suppose to retrieve the value found in column 'blademaster' in 'players' for player=Angel. Note that this works fine the first time Angel logs in the game (i.e., res=1, verified with the print statement). Now, if Angel logs out of the game and back in, res actually returns plus one more than the previous log in (i.e., second time res=2, third time res=3, etc.) I've tried the following:
Lua:
if db.storeQuery("SELECT `blademaster` FROM `players` WHERE `name` = \"Angel\";") == 1 then
print("test")
local condition = Condition(CONDITION_BLADEMASTER)
condition:setParameter(CONDITION_PARAM_TICKS, -1)
player:addCondition(condition)
end
which simply avoids using "local res", though this doesn't work for the same reason (I think).
It seems that every time storeQuery is called, it adds to some global variable that is hidden somewhere... Is there perhaps a "delete" or "free" function that resets the storeQuery global variable (if any)?