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

Need script fix

Dkadsfe

Member
Joined
Apr 1, 2016
Messages
280
Reaction score
22
Code:
    elseif param == "prestige" or param == "prestiges" or param == "prs" or param == "pr" then
        str = "# [Prestige] - Name\n"
        value = "Prestige"
        name = "name"
        result = ("(getCreatureStorage(thing.uid, 4500);")
I know this script works except for the result how do i make it show the creature storage 4500 this is like a !ranks command btw
 
i used this just to print in console for easy viewing, change it from
Code:
print("Name: "..ptable[i][1].." - Prestige: "..ptable[i][2])
to
Code:
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Name: "..ptable[i][1].." - Prestige: "..ptable[i][2])
which you would realize if you knew anything about lua
you should read up and try to learn it :)
How would I make this script open in a book?
 
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
    local storage = 4500
    local players = getPlayersOnline()
    local ptable = {}

    for i=1,#players,1 do
        ptable[i] = {getCreatureName(players[i]), getPlayerStorageValue(players[i], storage)}
    end
 
    table.sort(ptable, function(a,b) return a[2]>b[2] end)
 
    text = "[TOP PRESTIGE]\n"
    for i=1,#ptable,1 do
    text = text..""..ptable[i][1].." => "..ptable[i][2].."\n"
    end
        doShowTextDialog(cid, 1976, text)
end
 
Last edited:
talkactions for top 20
Code:
function onSay(cid, words, param)
    local players = getPlayersOnline()
    local ptable = {}
    local storage = 4500
    for i=1,#players,1 do
        ptable[i] = {getCreatureName(players[i]), getPlayerStorageValue(players[i], storage)}
    end
    table.sort(ptable, function(a,b) return a[2]>b[2] end)
    local n = function(t) if #t > 20 then return 20 else return #t end end
    for i=1,n(pbtable),1 do
        print("Name: "..ptable[i][1].." - Prestige: "..ptable[i][2])
    end
end
 
@Itutorial use
Code:
function onUse(cid, item, fromPosition, item2, toPosition)
local storage = 4500
local players = getPlayersOnline()
local ptable = {}

for i=1,#players,1 do
ptable[i] = {getCreatureName(players[i]), getPlayerStorageValue(players[i], storage)}
end

table.sort(ptable, function(a,b) return a[2]>b[2] end)

text = "[TOP PRESTIGE]\n"
local n = function(t) if #t > 20 then return 20 else return #t end end
for i=1,n(ptable),1 do
text = text..""..ptable[i][1].." => "..ptable[i][2].."\n"
end
doShowTextDialog(cid, 1976, text)
end
so it only shows top 20 at most, and also you have a "ptakle" instead of "ptable" at the end :)


...which you now edited and fixed :D
 
This last one is if you want them to use a talkaction but it still shows up in a book.

Code:
function onSay(cid, words, param, channel)
local storage = 4500
local players = getPlayersOnline()
local ptable = {}

for i=1,#players,1 do
ptable[i] = {getCreatureName(players[i]), getPlayerStorageValue(players[i], storage)}
end

table.sort(ptable, function(a,b) return a[2]>b[2] end)

text = "[TOP PRESTIGE]\n"
local n = function(t) if #t > 20 then return 20 else return #t end end
for i=1,n(ptable),1 do
text = text..""..ptable[i][1].." => "..ptable[i][2].."\n"
end
doShowTextDialog(cid, 1976, text)
end
 
Back
Top