• 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 Action Script

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
This script is showing all the messages, even if not having the storage, the correct one would be to show the messages only of those that we have globalstorage.

tfs 1.2


LUA:
local strings = {
    [1] = {storage = 100, text = "TESTE 1."}, -- Fury Gates
    [2] = {storage = 63321, text = "TESTE 2."}, -- nightmare isle
    [3] = {storage = 63322, text = "TESTE 3."}, -- Chyllfroest
    [4] = {storage = 63323, text = "TESTE 4."},   
    [5] = {storage = 63324, text = "TESTE 5."},
    [6] = {storage = 1290121, text = "TESTE 6."},
}

function onUse(cid, item, fromPosition, target, toPosition, isHotkey)
local player = Player(cid)
local name = player:getName()

    for i = 1, #strings do
        local t = strings[i]
        if getGlobalStorageValue(t.storage) then
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, t.text)
        end
    end
    return true
end
 
Solution
X
in 0.3.7, globalstorages have a value assigned to them, such as -1 when not in use.

I assume 1.x is the same, but with global storage being temporary.

try changing the line from
LUA:
if getGlobalStorageValue(t.storage) then
to
LUA:
if getGlobalStorageValue(t.storage) > 0 then
in 0.3.7, globalstorages have a value assigned to them, such as -1 when not in use.

I assume 1.x is the same, but with global storage being temporary.

try changing the line from
LUA:
if getGlobalStorageValue(t.storage) then
to
LUA:
if getGlobalStorageValue(t.storage) > 0 then
 
Solution
Back
Top