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

SetPlayerStorageValue with talkactions [TFS 1.x]

whitevo

Feeling good, thats what I do.
Joined
Jan 2, 2015
Messages
3,454
Solutions
1
Reaction score
627
Location
Estonia
Talkactions is so much easier to script xD i think i might start move my spells there.

Anyway here is the script i made to set and get storageValue in the game.
Ty for hint codinablack.

.XML
Code:
    <talkaction words="!setSV" separator=" " script="selfmade/setStorageValue.lua" />
    <talkaction words="!getSV" separator=" " script="selfmade/getStorageValue.lua" />
setStorageValue
Code:
function onSay(cid, words, param)
    local player = Player(cid)
    local split = param:split(",")
   
    if not player:getGroup():getAccess() then
        return true
    end
    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    player:setStorageValue(split[1], split[2])
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(TALKTYPE_MONSTER_SAY, "Storage "..split[1].." is set to "..split[2])
    return false
end
getStorageValue
Code:
function onSay(cid, words, param)
local player = Player(cid)
local split = param:split(",")
   
    if not player:getGroup():getAccess() then
        return true
    end
    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local storageValue = player:getStorageValue(param)
    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    player:sendTextMessage(TALKTYPE_MONSTER_SAY, "Storage "..param.." has value "..storageValue)
    return false
end
 
Last edited:
Is it possible to do this kind of spell without SourceCode edit?

Example:
Code:
<instant
group="support"
name="SetSV"
words="!setSV x, y"
mana="0"
needtarget="0"
params="2"
exhaustion="0"
groupcooldown="0"
needlearn="1"
script="setStorageValue.lua">

in words=
the x represent the storage
and y represent the new value

How can this be done?
Im more than sure lot of ppl will find use for it.
It helps making testing much faster.
Right now i gotta rework !test spell every time, when i want to know, are my storage value based things working correctly.


Not entirely sure what you are trying to do, but it would appear that talkactions may be the appropriate alternative for you.
 

Similar threads

Back
Top