• Vote in November Mapping Competition to select a winner!
  • 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!

setPlayerStorageValue only accepting values 1 or 0

PB3LL

Member
Joined
Oct 30, 2015
Messages
60
Reaction score
8
has anyone ever encountered this issue?

for some reason I am only able to set values to '0' or '1' when using lua.
i can manually change values in database of course.

when i use setPlayerStorageValue(cid, 92000, 0) = it works
when i use setPlayerStorageValue(cid, 92000, 1) = it works
when i use setPlayerStorageValue(cid, 92000, 2) = it does not work
when i use setPlayerStorageValue(cid, 92000, 3) = it does not work
etc.

anyone have any ideas why??
thanks for any help.

here is the talkaction script. perhaps it has errors i am not seeing that is causing the storage 92000 to not be set to 3.


Lua:
local config = {
    room = {x = 1072, y = 1020, z = 7}, -- location in room
    name = "town a trainers" -- name of location where players are sent
}


function onSay(cid, words, param)
if exhaustion.get(cid, 101) then
        doPlayerSendCancel(cid, 'You are exhausted.')
        return true
    end
    exhaustion.set(cid, 101, 60)
    if(param == '') and getPlayerStorageValue(cid, 42000) == 0 and getPlayerStorageValue(cid, 92000) == 0 then
    if(getPlayerLevel(cid) < 200) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to be between levels 200 and 209 to go there.")
    elseif(getPlayerLevel(cid) > 209) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to be between levels 200 and 209 to go there.")
    else
        local result = {}
        result = db.getResult("SELECT * FROM player_trainers WHERE id = 3")
        if result:getID() ~= -1 then
        local maximumTrainers = 10
        local currentTrainers = result:getDataInt("current")
        result:free()
        if currentTrainers < maximumTrainers then
        db.executeQuery("UPDATE player_trainers SET current = current + 1 WHERE id = 3")
        end
        end
        doTeleportThing(cid, config.room)
        setPlayerStorageValue(cid, 92000, 3)
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have joined the " ..config.name .." !")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
    end
    end
    return true
end
 
Last edited by a moderator:

Sajgon

Premium User
Premium User
Joined
Mar 10, 2017
Messages
229
Solutions
3
Reaction score
214
Location
Sweden
I don't knowwhy, but try use the below code instead, this works for me
Code:
player:setStorageValue(92000, 3)
 

Infernum

Senator
Joined
Feb 14, 2015
Messages
5,593
Solutions
555
Reaction score
3,520
where did you download your 0.4 sources from?
if you can use exhaustion for 60 seconds you can set storage values to whatever because exhaustion uses storage values
how do you know it doesn't work?
 
OP
PB3LL

PB3LL

Member
Joined
Oct 30, 2015
Messages
60
Reaction score
8
because when im checking my db the storage value never changes to anything other than '0' or '1' unless i do so in phpmyadmin. but the player gets tp'd and even gets the console message which happens after supposedly setting the storage value.

edit, sources from: [8.60] The Forgotten Server 0.4
 
Top