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

Solved !online Prestige not working

thanhlan94

Dragonot.zapto.org Owner
Joined
Jun 11, 2011
Messages
192
Reaction score
14
TFS 0.3.6
online.lua (I want it to show only reborns and not -1 for every reborn I have) (my storage is 4500)
Code:
local config = {
    showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
    local players = getPlayersOnline()
    local strings = {""}

    local i, position = 1, 1
    local added = false
    for _, pid in ipairs(players) do
        if(added) then
            if(i > (position * 7)) then
                strings[position] = strings[position] .. ","
                position = position + 1
                strings[position] = ""
            else
                strings[position] = i == 1 and "" or strings[position] .. ", "
            end
        end

        if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
            strings[position] = strings[position] .. getCreatureName(pid) .. "[ " ..getCreatureStorage(cid , reborn) .. "]"
            i = i + 1
            added = true
        else
            added = false
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:")
    for i, str in ipairs(strings) do
        if(str:sub(str:len()) ~= ",") then
            str = str .. "."
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
    end

    return true
end
 
Last edited:
In login.lua
Under onLogin(cid) add:
Code:
if getPlayerStorageValue(cid, 85987) == -1 then
        doPlayerSetStorageValue(cid, 85987, 0)
    end

EDIT:
Also change
Code:
strings[position] = strings[position] .. getCreatureName(pid) .. "[ " ..getCreatureStorage(cid , reborn) .. "]"
to
Code:
strings[position] = strings[position] .. getCreatureName(pid) .. "[ " ..getCreatureStorage(pid , reborn) .. "]"

Your script would show every single player's prestige as yours instead of theirs.
 
In login.lua
Under onLogin(cid) add:
Code:
if getPlayerStorageValue(cid, 85987) == -1 then
        doPlayerSetStorageValue(cid, 85987, 0)
    end

EDIT:
Also change
Code:
strings[position] = strings[position] .. getCreatureName(pid) .. "[ " ..getCreatureStorage(cid , reborn) .. "]"
to
Code:
strings[position] = strings[position] .. getCreatureName(pid) .. "[ " ..getCreatureStorage(pid , reborn) .. "]"

Your script would show every single player's prestige as yours instead of theirs.
Thanks but I did this and even tried changing the onlogin cid to 4500, but it still said -1 for prestige
 
This is my online command, you can see if it works for you:
Code:
local config = {
    showGamemasters = getBooleanFromString(getConfigInfo('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param)
    local players = getPlayersOnline()
    local strings = {}

    local i = 1
    local position = 1
    for _, pid in ipairs(players) do
        seal = true
        if param ~= "" then
            setPlayerStorageValue(cid, 30112, param)
            if getPlayerLevel(pid) < getPlayerStorageValue(cid, 30112) then
                seal = false
            end
        end
        if seal then
            if(i > (position * 7)) then
                strings[position] = strings[position] .. "\n"
                position = position + 1
                strings[position] = ""
            else
                strings[position] = i == 1 and "" or strings[position] .. "\n"
            end

            if((config.showGamemasters == TRUE or getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE or getPlayerCustomFlagValue(pid, PlayerCustomFlag_GamemasterPrivileges) ~= TRUE) and (isPlayerGhost(pid) ~= TRUE or getPlayerAccess(cid) > getPlayerAccess(pid))) then
                strings[position] = strings[position] .. getCreatureName(pid) .. " [LV: " .. getPlayerLevel(pid) .. "] [PR: ".. getPlayerStorageValue(pid, 4500) .."]"
                i = i + 1
            end
        end
    end

    for i, str in ipairs(strings) do
        if(str:sub(str:len()) ~= "\n") then
            str = str .. "."
        end
        doShowTextDialog(cid, 8267, str)
    end

    return TRUE
end

I already edited the storage for your prestige storage, so just copy/paste it in.

EDIT:
If it doesn't work, PM me your Skype and i'll help.
 
Last edited:
This is my online command, you can see if it works for you:
Code:
local config = {
    showGamemasters = getBooleanFromString(getConfigInfo('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param)
    local players = getPlayersOnline()
    local strings = {}

    local i = 1
    local position = 1
    for _, pid in ipairs(players) do
        seal = true
        if param ~= "" then
            setPlayerStorageValue(cid, 30112, param)
            if getPlayerLevel(pid) < getPlayerStorageValue(cid, 30112) then
                seal = false
            end
        end
        if seal then
            if(i > (position * 7)) then
                strings[position] = strings[position] .. "\n"
                position = position + 1
                strings[position] = ""
            else
                strings[position] = i == 1 and "" or strings[position] .. "\n"
            end

            if((config.showGamemasters == TRUE or getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE or getPlayerCustomFlagValue(pid, PlayerCustomFlag_GamemasterPrivileges) ~= TRUE) and (isPlayerGhost(pid) ~= TRUE or getPlayerAccess(cid) > getPlayerAccess(pid))) then
                strings[position] = strings[position] .. getCreatureName(pid) .. " [LV: " .. getPlayerLevel(pid) .. "] [PR: ".. getPlayerStorageValue(pid, 4500) .."]"
                i = i + 1
            end
        end
    end

    for i, str in ipairs(strings) do
        if(str:sub(str:len()) ~= "\n") then
            str = str .. "."
        end
        doShowTextDialog(cid, 8267, str)
    end

    return TRUE
end

I already edited the storage for your prestige storage, so just copy/paste it in.

EDIT:
If it doesn't work, PM me your Skype and i'll help.
Is this script for 0.3.6?
 
Back
Top Bottom