• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction (6.1) Cyber's REPSystem w/Opinion Points for 0.4 && mAAC

Is this the best reputation system?

  • Yes.

    Votes: 131 66.2%
  • No.

    Votes: 30 15.2%
  • It's good but can be improved.

    Votes: 37 18.7%

  • Total voters
    198
  • Poll closed .
Status
Not open for further replies.
Same error on this one too.
-.-?
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="THE BestReputationSystem" version="4" author="Cybermaster" contact="[email protected]" enabled="yes">

<config name="repFunctions"><![CDATA[
function getRepPoints(cid)
local Info = db.getResult("SELECT `rep` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
    local p = Info:getDataInt("rep")
    Info:free()
    return p
end

function getRepRank(points)
if points <= -5000 then
        REP_RANK = "Power Abuser (***==========)"
elseif points > -5000 and points <= -1500 then
        REP_RANK = "Evil (=**==========)"
elseif points > -1500 and points <= -1000 then
        REP_RANK = "Gangster (==*==========)"
elseif points > -1000 and points <= -500 then
        REP_RANK = "Villain (===|=========)"
elseif points > -500 and points <= -300 then
        REP_RANK = "PK (====|========)"
elseif points > -300 and points <= -1 then
        REP_RANK = "Bad Guy (======|======)"
elseif points >= 0 and points < 300 then
        REP_RANK = "Noob (======|======)"
elseif points >= 300 and points < 500 then
        REP_RANK = "Well-Known (=======|=====)"
elseif points >= 500 and points < 1000 then
        REP_RANK = "Popular (========|====)"
elseif points >= 1000 and points < 1500 then
        REP_RANK = "Hailed (=========|===)"
elseif points >= 1500 and points < 2000 then
        REP_RANK = "The Best (==========+==)"
elseif points >= 2000 and points < 5000 then
        REP_RANK = "Hero (==========++=)"
elseif points >= 5000 then
        REP_RANK = "Legendary Hero (==========+++)"
end
        return REP_RANK
end

function setPlayerRep(cid, points)
    db.executeQuery("UPDATE `players` SET `rep` = " .. points .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
end

function addPlayerRep(cid, amount, color)
        db.executeQuery("UPDATE `players` SET `rep` = `rep` + " .. amount .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
        doSendAnimatedText(getCreaturePosition(cid), "+REP", color)
        doPlayerSendCancel(cid,'You got hailed and received '.. amount ..' rep points.')
end

function removePlayerRep(cid, amount, color)
    db.executeQuery("UPDATE `players` SET `rep` = `rep` - " .. amount .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")
        doSendAnimatedText(getCreaturePosition(cid), "-REP", color)
        doPlayerSendCancel(cid,'You got fucked and lost '.. amount ..' rep points.')    
end

function repTime(timeDiff) --configured for 6 hours, pm me if you dont know how to change it
    local dateFormat = {    
        --{"day", timeDiff / 60 / 60 / 24 % 7},
                {"hour", timeDiff / 60 / 60 % 6},
        {"minute", timeDiff / 60 % 60},
        {"second", timeDiff % 60}
    }

    local out = {}
    for k, t in ipairs(dateFormat) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
   
    return table.concat(out)
end

function isPlayerFemale(cid)
        return getPlayerSex(cid) == 0 and true or false
end]]></config>
       
        <event type="login" name="repRegister" event="script"><![CDATA[
        domodlib('repFunctions')
        function onLogin(cid)
                registerCreatureEvent(cid, "repLook")  
                registerCreatureEvent(cid, "repDeath")
                registerCreatureEvent(cid, "repKill")  
                registerCreatureEvent(cid, "repMonster")
        return true
        end]]></event>
       
        <event type="look" name="repLook" event="script"><![CDATA[
        domodlib('repFunctions')
        function onLook(cid, thing, position, lookDistance)
                if(isPlayer(thing.uid) == true) then
                        if(thing.uid == cid) then
                                doPlayerSendTextMessage(cid, 20, "You are "..getRepRank(getRepPoints(cid)).."")
                        else
                                doPlayerSendTextMessage(cid, 20, ""..getCreatureName(thing.uid).." is "..getRepRank(getRepPoints(thing.uid)).."")
                        end
                return true
                end            
        return true
        end]]></event>
       
        <event type="death" name="repDeath" event="script"><![CDATA[
        domodlib('repFunctions')
        function onDeath(cid, corpse, deathList)  
        if (isPlayer(cid) == true) then
                        if (getRepPoints(cid)==0) then
                                return true
                        elseif (getRepPoints(cid) > 0) then
                                removePlayerRep(cid, 5, TEXTCOLOR_RED)
                        else
                                addPlayerRep(cid, 5, TEXTCOLOR_RED)
                        end
        return true
        end
        end]]></event>
               
        <event type="kill" name="repKill" event="script"><![CDATA[
        domodlib('repFunctions')
        function onKill(cid, target, lastHit)
                if (isPlayer(cid) == true) and (isPlayer(target) == true) then
                        if getPlayerSkullType(target) == SKULL_WHITE then
                                addPlayerRep(cid, 15, TEXTCOLOR_LIGHTBLUE)
                        elseif getPlayerSkullType(target) == SKULL_RED then
                                addPlayerRep(cid, 30, TEXTCOLOR_LIGHTBLUE)
                        elseif getPlayerSkullType(target) == SKULL_BLACK then
                                addPlayerRep(cid, 45, TEXTCOLOR_LIGHTBLUE)
                        elseif getPlayerSkullType(target) == SKULL_NONE then
                                removePlayerRep(cid, 30, TEXTCOLOR_RED)
                        end
                else
                        return TRUE
                end
        end]]></event>
               
        <event type="kill" name="repMonster" event="script"><![CDATA[
        domodlib('repFunctions')
        -- >>> To add a new monster, copy an ..elseif.. line and modify it<<< --
        function onKill(cid, target, lastHit)
                if (isPlayer(cid) == true) and (isMonster(target) == true) then
                        if getCreatureName(target) == "Demon" then
                                addPlayerRep(cid, 10, TEXTCOLOR_LIGHTGREEN)
                        elseif getCreatureName(target) == "Behemoth" then
                                        addPlayerRep(cid, 5, TEXTCOLOR_LIGHTGREEN)
                        elseif getCreatureName(target) == "Orshabaal" then
                                addPlayerRep(cid, 15, TEXTCOLOR_LIGHTGREEN)
                        elseif getCreatureName(target) == "Hellfire Fighter" then
                                        addPlayerRep(cid, 5, TEXTCOLOR_LIGHTGREEN)
                        end    
                end
        return TRUE
        end]]></event>
       
        <talkaction log= "yes" words="/hail; /fuck; /set" access="4" event="buffer"><![CDATA[
        domodlib('repFunctions')
        -- >>> t[1] is Player Name, t[2] is Rep Amount<<< --
       
                if(param == "") then
                        doPlayerSendCancel(cid,"You have to type a player name.")
                return TRUE
                end

                local t = string.explode(param, ",")
                local tid = getPlayerByName(t[1])

                if(isPlayer(tid) == false) then
                        doPlayerSendCancel(cid, "Player " .. param .. " not found or is offline.")
                return TRUE
                end
       
                if isPlayerFemale(tid) == true then
                        sex = 'she'
                                else
                        sex = 'he'
                end
       
                if(not t[2]) and (isPlayer(tid) == true) then  
                        if (words == '/hail') then
                                addPlayerRep(tid, 5, TEXTCOLOR_TEAL)
                                doPlayerSendCancel(cid, "You added +5 rep points to " .. getPlayerName(tid) .. ", and now " .. sex .. " has " .. getRepPoints(tid) .. " rep points.")
                        return true
                        end
               
                        if words == '/fuck' then
                                removePlayerRep(tid, 5, TEXTCOLOR_RED)
                                doPlayerSendCancel(cid, "You removed -5 rep points to " .. getPlayerName(tid) .. ", and now " .. sex .. " has " .. getRepPoints(tid) .. " rep points.")
                        return true
                        end
                end
       
                if (t[2]) and (words == '/set') or (words == '/hail') or (words == '/fuck') then
                        if (not tonumber(t[2])) then
                                doPlayerSendCancel(cid, "Rep amount invalid.")
                        return true
                        end                                    
                end
       
                if words == '/hail' then
                        addPlayerRep(tid, t[2], TEXTCOLOR_TEAL)
                        doPlayerSendCancel(cid, "You added  " .. t[2] .. " rep points to " .. getPlayerName(tid) .. ", and now " .. sex .. " has " .. getRepPoints(tid) .. " rep points.")
                        return true
                end
               
                if words == '/fuck' then
                        removePlayerRep(tid, t[2], TEXTCOLOR_RED)
                        doPlayerSendCancel(cid, "You removed  " .. t[2] .. " rep points to " .. getPlayerName(tid) .. ", and now " .. sex .. " has " .. getRepPoints(tid) .. " rep points.")
                        return true
                end
               
                if (t[2]) and (words == '/set') then
                        setPlayerRep(tid, t[2])
                        doPlayerSendCancel(cid, "You have set " .. getPlayerName(tid) .. "'s rep points to " .. getRepPoints(tid) .. ".")
                else
                        doPlayerSendCancel(cid, "Absolute rep amount not specified.")
                        return true
                end
       
                if(not t[2]) then
                        doPlayerSendCancel(cid, "Absolute rep amount not specified.")
                        return true
                end
       
                ]]></talkaction>
       
        <talkaction words="!ranks" event="buffer"><![CDATA[
        domodlib('repFunctions')
       
                local players = 10 -- The amount of max players that is shown in each list
                local str, value, name, result = "","","",0,nil -- don't touch --
        if param == "hero" or param == "pos" or param == "+" then
                        str,value,name = "[#]-[Name]-[Points]-[Rank]\n--[Positive Rep Highscores]--\n","rep","name"
                        result = db.getResult("SELECT `name`, `rep` FROM `players` WHERE players.rep > -1 ORDER BY `rep` DESC, `name` ASC;")
                elseif param == "evil" or param == "neg" or param == "-" then
                        str,value,name = "[#]-[Name]-[Points]-[Rank]\n--[Negative Rep Highscores]--\n","rep","name"
                        result = db.getResult("SELECT `name`, `rep` FROM `players` WHERE players.rep < 0 ORDER BY `rep` ASC, `name` DESC;")    
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Unknown Paramater: '" .. param .. "'")
                        return TRUE
                end

                if (result:getID() ~= -1) then
                        local i = 1
                        while TRUE do
                                str = str .. "\n " .. i .. ". - " .. result:getDataString("name") .. " - [" .. result:getDataInt(value) .. "] - " .. getRepRank(result:getDataInt(value)) .. ""
                                i = i+1
                                if not(result:next()) or i > players then
                                        break
                                end
                        end
                        result:free()
                end
                if str ~= "" then
                        doPlayerPopupFYI(cid, str)
                end
                return TRUE
        ]]></talkaction>
       
        <talkaction words="!rep" event="buffer"><![CDATA[
        domodlib('repFunctions')
       
        local o, points, action = getCreatureOutfit(cid), getRepPoints(cid), false --do not modify
        doPlayerSendTextMessage(cid, 19, "You have " .. points .. " rep points. You are " .. getRepRank(points) .. ".")
                if points > 4999 and getPlayerSex(cid) == 0 then --female rep+++ queen outfit
                        disguise, text, action = {lookType = 331}, "Queen!!", true
                elseif points > 4999 and getPlayerSex(cid) > 0 then --male rep+++ king outfit
                        disguise, text, action = {lookType = 332}, "King!!", true
                elseif points > 1999 then --rep++ cm outfit
                        disguise, text, action = {lookType = 266}, "Legend!!", true
                elseif points > 1499 then --rep+ hero outfit
                        disguise, text, action = {lookType = 73}, "Hero!!", true
                elseif points < -4999 then --rep*** devil outfit
                        disguise, text, action = {lookType = 40}, "Devil!!", true
                elseif points < -1999  then --rep** pig outfit --
                        disguise, text, action = {lookType = 60}, "Pig!!", true
                elseif points < -1499 then --rep* orc outfit --
                        disguise, text, action = {lookType = 5}, "Orc!!", true
                end
                if action == true then
                        doCreatureChangeOutfit(cid, disguise)
                        doSendAnimatedText(getCreaturePosition(cid), text, math.random(01,255))
                return true
                end ]]></talkaction>
       
        <talkaction words="!hail" event="buffer"><![CDATA[
        domodlib('repFunctions')
       
        local config =
        {   newTime = 6 * 60 * 60, -- This is [6] hours, in seconds. Time between rep.
                oldTime = getPlayerStorageValue(cid, 23232),
                level = 20,      
                target = getPlayerByName(param)
        }
                if config.oldTime == -1 then
                        setPlayerStorageValue(cid, 23232, os.time())
                end
                       
                local nextTime = config.oldTime - os.time()
                local nextDate = os.date("%d %B %Y %X", config.oldTime + config.newTime)
               
                if getPlayerLevel(cid) < config.level then
                        doPlayerSendCancel(cid,"You may hail from level "..config.level.." and above.")
                return TRUE
                end
       
                if (os.time() - config.oldTime) < config.newTime then
                        doPlayerSendCancel(cid, "You may hail in " .. repTime(nextTime) .. ", (".. nextDate..").")
                return TRUE
                end
       
                if(param == "") then
                        doPlayerSendCancel(cid,"You have to type a player name.")
                return TRUE
                end
       
                if isPlayer(config.target) == false then
                        doPlayerSendCancel(cid,"That player doesn't exist or is offline.")
                return TRUE
                end
               
                if getPlayerIp(cid) == getPlayerIp(config.target) then
                        doPlayerSendCancel(cid,"You may not hail yourself or your same IP.")  
                return TRUE
                end

        addPlayerRep(config.target, 5, TEXTCOLOR_LIGHTBLUE)
        setPlayerStorageValue(cid, 23232, os.time())
        doPlayerSendCancel(cid,'You just hailed '.. getPlayerName(config.target) ..'.')      
    ]]></talkaction>
       
        <talkaction words="!fuck" event="buffer"><![CDATA[
        domodlib('repFunctions')
       
        local config =
        {   newTime = 6 * 60 * 60, -- This is [6] hours, in seconds. Time between rep.
                oldTime = getPlayerStorageValue(cid, 23232),
                level = 20,      
                target = getPlayerByName(param)
        }
                if config.oldTime == -1 then
                        setPlayerStorageValue(cid, 23232, os.time())
                end
                       
                local nextTime = config.oldTime - os.time()
                local nextDate = os.date("%d %B %Y %X", config.oldTime + config.newTime)
               
                if getPlayerLevel(cid) < config.level then
                        doPlayerSendCancel(cid,"You may fuck from level "..config.level.." and above.")
                return TRUE
                end
       
                if (os.time() - config.oldTime) < config.newTime then
                        doPlayerSendCancel(cid, "You may fuck in " .. repTime(nextTime) .. ", (".. nextDate..").")
                return TRUE
                end
       
                if(param == "") then
                        doPlayerSendCancel(cid,"You have to type a player name.")
                return TRUE
                end
       
                if isPlayer(config.target) == false then
                        doPlayerSendCancel(cid,"That player doesn't exist or is offline.")
                return TRUE
                end
       
                if getPlayerIp(cid) == getPlayerIp(config.target) then
                        doPlayerSendCancel(cid,"You may not fuck yourself or your same IP.")  
                return TRUE
                end

        removePlayerRep(config.target, 5, TEXTCOLOR_RED)
        setPlayerStorageValue(cid, 23232, os.time())
        doPlayerSendCancel(cid,'You just fucked '.. getPlayerName(config.target) ..'.')      
    ]]></talkaction>
</mod>
 
hi, I don know a lot about this stuff, but i try to learn and do new things.
y added this in my layout of tibiacom (in gesior):

</a>
<a href='?subtopic=rep'>
<div id='submenu_rep' class='Submenuitem' onMouseOver='MouseOverSubmenuItem(this)' onMouseOut='MouseOutSubmenuItem(this)'>
<div class='LeftChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
<div id='ActiveSubmenuItemIcon_rep' class='ActiveSubmenuItemIcon' style='background-image:url(<?PHP echo $layout_name; ?>/images/menu/icon-activesubmenu.gif);'></div>
<div class='SubmenuitemLabel'>Reputation</div>
<div class='RightChain' style='background-image:url(<?PHP echo $layout_name; ?>/images/general/chain.gif);'></div>
</div>
</a>


it all worken wonderfully, but i can only see the good rep. not the bad rep.
what should i do?

this is what happends:
asdfgjki.jpg
 
Last edited:
@stonger: by default there are not negative repped players on the ots until they appear
 
great, thanks.
now i have this little problem:
1568796489-1.jpg



how can I put them side to side? <-----i dont know if this expression is correct
 
Last edited:
idk side to side real correction, english is not my native language
rofl that red bar is swirly, but why didn't leave the original?
or is it your layout? damn tibiacom I tested mine in another layout
 
well, i think that i didnt change antything in the scripts. i will do all again
-------------------------------------------------------------------------------------
still the same thing

-------------------------------------------------------------------------------------

maybe, it should be because the images are too big. gonna resize them
 
For Rep Highscores page
isnt there missing anything to add on layouts.php?
 
@lava yes, you should know how to do that, anyway I'll post it
@stonger, i'll do it :) thats because I made them for another layout, not tibiacom
 
Ready, it was the size of the pictures. i rezised them to an 81% of the original size and this happends:

Dibujo.jpg



now i have two questins =P :
-how do i center them, so the pictures fits woth the table that is down?
-how can i correct where the name,rep points and rep rank appears?
 
thats because the images are too big. you must resize them
--------------------------------------------------------------------------

i set the images in te 85% (aproximated) of the original size and it works fine.
the only problem now is that the letters are not in the place they are supposed to be. trying to find how to fix it
 
Last edited:
i added this:

PHP:
<div class="item"><a href="?subtopic=rep">Reputation Ranks</a></div>
 
ok. i have almost all ready.

my only problem is that the name, points and rank, appears lower than they should appear. i couldnt find how to fix it, so, the solution i have for this problem is using photoshop and make the image fit with the letters.

i dont know if i explained myself correctly. (not native english speaker)
 
is your layout tibiacom? that can be fixed in repPics.php
@lava send me ur layout download link and I'll fix the php for u :)
 
photoshop is not working for me.
cybermaster: can u tell me where can i correct the place of the name, rank, rep?

please =D
 
just gimme the link to download your layout, or name and I'll fix it , that way thiss will be faster,
 
Status
Not open for further replies.
Back
Top