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

TFS 1.X+ set storage talkaction

norrow

Member
Joined
Dec 16, 2012
Messages
129
Reaction score
7
Location
Poland
I have a question, whether it would be possible to rewrite this script on TFS 1 + series ?

Lua:
function onSay(cid, words, param)
    local t = string.explode(param, ",")
    if(not t[2]) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
        return true
    end

    local tid = getPlayerByNameWildcard(t[1])
    if(not tid or (isPlayerGhost(tid) and getPlayerGhostAccess(tid) > getPlayerGhostAccess(cid))) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
        return true
    end

    if(not t[3]) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, " [" .. t[1] .. " - " .. t[2] .. "] = " .. getPlayerStorageValue(tid, t[2]))
    else
        setPlayerStorageValue(tid, t[2], t[3])
    end

    return true
end
 
@norrow
Lua:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local params = string.split(param, ",")

    local targetPlayer = Player(params[1])
    if not targetPlayer then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
        return true
    end

    if not params[2] or not tonumber(params[2]) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified. Second parameter must be a number.")
        return true
    end
    params[2] = tonumber(params[2])

    if not params[3] then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Get [" .. params[1] .. " - " .. params[2] .. "] = " .. targetPlayer:getStorageValue(params[2]))
    else
        if tonumber(params[3]) then
            params[3] = tonumber(params[3])
            targetPlayer:setStorageValue(params[2], params[3])
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Set [" .. params[1] .. " - " .. params[2] .. "] = " .. targetPlayer:getStorageValue(params[2]))
        else
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified. Third parameter must be a number.")
        end
    end

    return true
end
 
Last edited:
Back
Top