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

Lua [SQLite] -=[TFS]=- 0.4 8.60 [TALKACTION] HOW TO ADD COMMAND /ADDSTORAGE

samuel157

/root
Joined
Mar 19, 2010
Messages
447
Solutions
3
Reaction score
49
Location
São Paulo, Brazil
GitHub
Samuel10M
[SQLite] -=[TFS]=- 0.4 8.60 [TALKACTION] HOW TO ADD COMMAND /ADDSTORAGE SAME PLAYER STANDING OFFLINE AND ONLINE

COMMAND EXAMPLE: /addstorage test, key -> 14789 -> value /addstorage test, 14789, 0 or -1 or 1
 
Solution
It is only possible to add storage to a player who is online. But to emphasize, learn to read before repeating yourself. IT IS NOT POSSIBLE to add storage to a player who is offline, ok?
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...
It is only possible to add storage to a player who is online. But to emphasize, learn to read before repeating yourself. IT IS NOT POSSIBLE to add storage to a player who is offline, ok?
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

XML:
<talkaction log="yes" words="/storage" access="5" event="script" value="comandos gm/storage.lua"/>

/storage samuel157, 14789, 1
 
Solution

Similar threads

Back
Top