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


Uploaded with ImageShack.us

What's wrong? :/
None, when there are not negative or positive repped players it does not display them, I designed it to be like that. Once a player has negative rep it will appear.
 
preview of incoming rep 7.0 revision, tfs 0.4 edition
XML:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Cyber's REP++ System" rev="7.0" tfs="0.4" author="Cybermaster" web="OTLand.net" enabled="yes">
    <query>
        ALTER TABLE `players` ADD COLUMN `rep` INT(11) NOT NULL DEFAULT '0' COMMENT 'Cyber''s REPSystem © OTLand.net';
    </query>
    <config name="repSystem">
        <![CDATA[
            rep = {
            --[[ MAIN CONFIG ]]--
                
                interval = 3 * 60, 
                --THIS IS [3] HOURS, IN MINUTES. TIME IN MINUTES TO BE ONLINE TO GAIN [1] OPINION POINT
                
                minLevel = 20, 
                --FROM THIS LEVEL ONWARDS PLAYERS CAN USE COMMANDS
                
                pvpLevel = 30, 
                --MINIMUM LEVEL FOR PVP REPPING
                
                required = 5, 
                --OPINION POINTS REQUIRED TO REPUTE WITH TALKACTION COMMAND
                
                default = 5,
                --DEFAULT REP POINTS ADDED/REMOVED
                
                results = 10,
                --RESULTS TO APPEAR FOR REP HIGHSCORES
                
                exhaustion = 5 * 60, 
                --SECONDS TO WAIT TO BE ABLE TO USE !REP COMMAND AGAIN, DEFAULT IS 5 MINUTES
                
                allowMultiRepByCommand = 'yes', 
                --ALLOW PLAYERS TO REPUTE AGAIN LAST REPUTED PLAYER? Options: 'yes' - 'no' 
                
                allowMultiRepByKill = 'no', 
                --ALLOW PLAYERS GAIN/LOSE REP WHEN KILLING VICTIM TWICE? Options: 'yes' - 'no' 
                
                allowRepInPvPTile = 'no',
                --PLAYERS GAIN/LOSE REP WHEN KILLING/KILLED AT PVP(HARDCORE) TILES? Options: 'yes' - 'no' 
                
                usePower = 'no',
                --USE REP POWER FEATURE? Options: 'yes' - 'no' 
            
            --[[ PLAYER STORAGES ]]--
                
                exhaust = 5045, 
                --EXHAUSTION FOR !REP COMMAND
                
                lastName = 5036, 
                --STORES LAST REPPED'S GUID
                
                lastKilled = 5037, 
                --STORES LAST KILLED'S GUID, USED ONLY IF allowMultiRepByKill == 'no'
                
                opinion = 5038, 
                --STORES OPINION POINTS
                
                online = 5039, 
                --STORES ONLINE MINUTES
                
                alert = {
                    [1] = 'You have just obtained an opinion point.',
                    [2] = 'You have just been hailed and gained %d reputation points.',
                    [3] = 'You have just been repudiated and lost %d reputation points.',
                    [4] = 'You %s reputation because you killed a player.',
                    [5] = 'You lose reputation because you were killed by a player.',
                    [6] = '[REP_SYSTEM] You must write a player\'s name.',
                    [7] = '[REP_SYSTEM] Player %s not found.',
                    [8] = '[REP_SYSTEM] You %s %d rep points to %s, and now %s has %d points.',
                    [9] = '[REP_SYSTEM] Reputation amount is invalid.',
                    [10] = '[REP_SYSTEM] You have set %s\'s rep points to %d',
                    [11] = 'You can not use this command yet[%d].',
                    [12] = 'Unknown parameter, use only (+|-|1|2).',
                    [13] = 'No results were found.',
                    [14] = 'Player %s not found.',
                    [15] = 'You may repute from level %d onwards.',
                    [16] = 'You may not repute neither yourself nor anyone in your IP.',
                    [17] = 'You are not allowed to repute same player two times in a row.',
                    [18] = 'You do not have enough opinion points.',
                    [19] = 'You have just reputed %s. You have %d opinion points left.',                    
                },
                
                skull = {
                    [SKULL_WHITE] = 15,
                    [SKULL_RED] = 20,
                    [SKULL_BLACK] = 40,
                    [SKULL_NONE] = -30
                },
                
                monster = { --[monstername in lowercase] = +rep amount
                    ['demon'] = 3,
                    ['behemoth'] = 4,
                    ['hellfire fighter'] = 5,
                    ['orshabaal'] = 10,
                },
             
                doOpinion = function(cid)
                    if isPlayer(cid) then 
                        doCreatureSetStorage(cid, rep.online, getCreatureStorage(cid, rep.online)+1)
                        if getCreatureStorage(cid, rep.online) >= rep.interval then
                            doCreatureSetStorage(cid, rep.online, 0)
                            doCreatureSetStorage(cid, rep.opinion, getCreatureStorage(cid, rep.opinion)+1)
                            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, rep.alert[1])
                        end
                        repEvent = addEvent(rep.doOpinion, 60*1000, cid)
                    end
                end,
                                
                getArticle = function(cid, uppercase)
                    return (getPlayerSex(cid) == 0 and (uppercase and 'Sh' or 'sh') or (uppercase and 'H' or 'h')) .. 'e'
                end,
           
                getPoints = function(cid)
                    local result = db.getResult('SELECT `rep` FROM `players` WHERE `id` = '.. getPlayerGUID(cid))
                    local data = result:getDataInt('rep')
                    result:free()
                    return data
                end,
           
                getData = function(points)
                    table = { --[FROM, TO] = {RANK, ID, POWER[[, OUTFIT LOOKTYPE, OUTFIT MESSAGE]]}
                            [{-math.huge, -5000}] = {'Power Abuser (*<<==========)',13,7,40,'Devil!!!'},
                            [{-4999, -2000}] = {'Evil (=*<==========)',12,6,60,'Pig!!'},
                            [{-1999, -1500}] = {'Slayer (==*==========)',11,5,5,'Orc!'},
                            [{-1499, -1000}] = {'Killer (===|=========)',10,4},
                            [{-999, -500}] = {'Villain (====|========)',9,3},
                            [{-499, -300}] = {'Creeping (=====|=======)',8,2},
                            [{-299, 299}] = {'Unknown (======|======)',7,1},
                            [{300, 499}] = {'Avowed (=======|=====)',6,2},
                            [{500, 999}] = {'Popular (========|====)',5,3},
                            [{1000, 1499}] = {'Hailed (=========|===)',4,4},
                            [{1500, 1999}] = {'Acclaimed (==========+==)',3,5,266,'Famous!'},
                            [{2000, 4999}] = {'Hero (==========>+=)',2,6,266,'Hero!!'},
                            [{5000, math.huge}] = {'Legend (==========>>+)',1,7,331,'Legend!!!'},
                        }
                    for a, b in pairs(table) do
                        if points >= a[1] and points <= a[2] then
                            return b
                            --[[
                                b[1] = rank
                                b[2] = id
                                b[3] = power
                                b[4] = looktype
                                b[5] = message
                            ]]--
                        end
                    end
                end,           
           
                set = function(cid, points)
                    return db.executeQuery('UPDATE `players` SET `rep` = ' .. points .. ' WHERE `id` = ' .. getPlayerGUID(cid))
                end,

                add = function(cid, amount, color)
                    db.executeQuery('UPDATE `players` SET `rep` = `rep` + ' .. amount .. ' WHERE `id` = ' .. getPlayerGUID(cid))
                    doSendAnimatedText(getThingPos(cid), '+REP', color or math.random(255))
                    doPlayerSendCancel(cid, rep.alert[2]:format(amount))
                end,
                           
                remove = function(cid, amount, color)
                    db.executeQuery('UPDATE `players` SET `rep` = `rep` - ' .. amount .. ' WHERE `id` = ' .. getPlayerGUID(cid))
                    doSendAnimatedText(getThingPos(cid), '-REP', color or math.random(255))
                    doPlayerSendCancel(cid, rep.alert[3]:format(amount))
                end                
            }
        ]]>
    </config>

    <event type="login" name="repRegister" event="script">
        <![CDATA[
            domodlib('repSystem')
            function onLogin(cid)
                repEvent = addEvent(rep.doOpinion, 60*1000, cid)
                if getCreatureStorage(cid, rep.opinion) == EMPTY_STORAGE then
                    doCreatureSetStorage(cid, rep.online, 0)
                    doCreatureSetStorage(cid, rep.opinion, 0)
                end
                registerCreatureEvent(cid, "repLook")
                registerCreatureEvent(cid, "repKill")
                registerCreatureEvent(cid, "repMonster")
                return true
            end
        ]]>
    </event>
           
    <event type="look" name="repLook" event="script">
        <![CDATA[
            domodlib('repSystem')
            function onLook(cid, thing, position, lookDistance)
                if isPlayer(thing.uid) and thing.uid ~= cid then
                    return doPlayerSetSpecialDescription(thing.uid,'\n'.. rep.getArticle(thing.uid, true)..' is ' .. rep.getData(rep.getPoints(thing.uid))[1])
                elseif thing.uid == cid then     
                    local string = 'You see yourself.'
                    if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then
                        string = string..' You are '.. getPlayerGroupName(cid) ..'.'
                    elseif getPlayerVocation(cid) ~= 0 then
                        string = string..' You are '.. getPlayerVocationName(cid) ..'.'
                    else
                        string = string..' You have no vocation.'
                    end
                                
                    if getPlayerNameByGUID(getPlayerPartner(cid), false, false) ~= nil then
                        string = string..' You are '.. (getPlayerSex(cid) == 0 and 'wife' or 'husband') ..' of '.. getPlayerNameByGUID(getPlayerPartner(cid)) ..'.'
                    end
            
                    if getPlayerGuildId(cid) > 0 then 
                        string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid)
                        string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.'
                    end 
                    
                    string = string..'\nYou are '.. rep.getData(rep.getPoints(cid))[1] .. '.'
            
                    if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then
                        string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].'
                        string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.'
                    end
            
                    if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then
                        string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].'
                    end
                    return false, doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)  
                end
                return true
            end
        ]]>
    </event>
                   
    <event type="kill" name="repKill" event="script">
        <![CDATA[
            domodlib('repSystem')
            function onKill(cid, target, damage, flags)
                if not isPlayer(target) or not isInArray({1,3},flags) or getPlayerIp(cid) == getPlayerIp(target) then
                    return true
                end
                    
                if not getBooleanFromString(rep.allowMultiRepByKill) and getCreatureStorage(cid, rep.lastKilled) == getPlayerGUID(target) then
                    return true
                end
                    
                if not getBooleanFromString(rep.allowRepInPvpTile) and getTileInfo(getThingPos(cid)).hardcore then
                    return true
                end
                
            --THE KILLER
                if rep.skull[getCreatureSkullType(target)] and getPlayerLevel(target) >= rep.pvpLevel then
                    doSendAnimatedText(getThingPos(cid), getCreatureSkullType(target) == 0 and '-REP' or '+REP', math.random(255))
                    rep.set(cid, rep.getPoints(cid)+rep.skull[getCreatureSkullType(target)])
                    doPlayerSendCancel(cid, rep.alert[4]:format(getCreatureSkullType(target) == 0 and 'lose' or 'gain'))
                    if not getBooleanFromString(rep.allowMultiRepByKill) then
                        doCreatureSetStorage(cid, rep.lastKilled, getPlayerGUID(target))
                    end
                end
            --THE VICTIM
                if rep.getPoints(target) == 0 then
                    return true
                elseif rep.getPoints(target) > 0 then
                    rep.remove(target, 5, COLOR_RED)
                    doPlayerSendCancel(target, rep.alert[5])
                else
                    rep.add(target, 5, COLOR_LIGHTBLUE)
                    doPlayerSendCancel(target, rep.alert[5])
                end
                return true
            end
        ]]>
    </event>
                       
    <event type="kill" name="repMonster" event="script">
        <![CDATA[
            domodlib('repSystem')
            function onKill(cid, target, damage, flags)
                if isMonster(target) and rep.monster[getCreatureName(target):lower()] and isInArray({1,3},flags) then
                    rep.add(cid, rep.monster[getCreatureName(target):lower()])
                end
                return true
            end
        ]]>
    </event>
           
    <talkaction log="yes" words="/hail;/fuck;/set" access="4" event="buffer">
        <![CDATA[
            domodlib('repSystem')
            if param == '' then
                return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,rep.alert[6])
            end

            local t = string.explode(param, ',')
            local tid = getPlayerByNameWildcard(t[1])

            if not isPlayer(tid) then
                return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[7]:format(param))
            end
           
            if not t[2] then
                if words == '/hail' then
                    rep.add(tid, rep.default, COLOR_TEAL)
                    return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[8]:format('added',rep.default,getCreatureName(tid),rep.getArticle(tid),rep.getPoints(tid)))
                elseif words == '/fuck' then
                    rep.remove(tid, rep.default, COLOR_RED)
                    return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[8]:format('removed',rep.default,getCreatureName(tid),rep.getArticle(tid),rep.getPoints(tid)))
                end
            end
           
            if not isNumeric(t[2]) then
                return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[9])
            end
           
            if words == '/hail' then
                rep.add(tid, math.abs(t[2]), COLOR_TEAL)
                return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[8]:format('added',math.abs(t[2]),getCreatureName(tid),rep.getArticle(tid),rep.getPoints(tid)))
            elseif words == '/fuck' then                
                rep.remove(tid, math.abs(t[2]), COLOR_RED)
                return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[8]:format('removed',math.abs(t[2]),getCreatureName(tid),rep.getArticle(tid),rep.getPoints(tid)))  
            elseif words == '/set' then
                rep.set(tid, t[2])
                return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[10]:format(getCreatureName(tid),rep.getPoints(tid)))
            end           
        ]]>
    </talkaction>
                  
    <talkaction words="!rep" event="buffer">
        <![CDATA[
            domodlib('repSystem')
            if exhaustion.check(cid, rep.exhaust) then
                return doPlayerSendCancel(cid, rep.alert[11]:format(exhaustion.get(cid, rep.exhaust)))
            else
                exhaustion.set(cid, rep.exhaust, rep.exhaustion)
            end
            
            if param ~= '' then
                local str, value, name, result = '', '',' ', 0, nil
                if isInArray({'hero','pos','1','+'}, param) then
                    str,value,name = '[#]-[Name]-[Points]-[Rank]\n--[Positive Reputation Highscores]--\n','rep','name'
                    result = db.getResult('SELECT `name`, `rep` FROM `players` WHERE `rep` > 0 AND `name` NOT LIKE "%Sample" AND `name`!= "Account Manager" AND `deleted` = 0 AND `group_id` = 1 ORDER BY `rep` DESC LIMIT '.. rep.results)
                elseif isInArray({'evil','neg','2','-'}, param) then
                    str,value,name = '[#]-[Name]-[Points]-[Rank]\n--[Negative Reputation Highscores]--\n','rep','name'
                    result = db.getResult('SELECT `name`, `rep` FROM `players` WHERE `rep` < 0 AND `name` NOT LIKE "%Sample" AND `name`!= "Account Manager" AND `deleted` = 0 AND `group_id` = 1 ORDER BY `rep` ASC LIMIT '.. rep.results)
                else
                    return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[12])
                end

                if isInArray({-1,nil,false,''},result:getID()) then
                    return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, rep.alert[13])
                end
                local i = 1
                while true do
                    str = str .. '\n ' .. i .. '. ' .. result:getDataString('name') .. ' - [' .. result:getDataInt(value) .. '] - ' .. rep.getData(result:getDataInt(value))[1]
                    i = i + 1
                    if not(result:next()) then
                        break
                    end
                end
                result:free()
                return doPlayerPopupFYI(cid, str)
            elseif param == '' then
                local points, name = rep.getPoints(cid), getPlayerNameByGUID(getCreatureStorage(cid, rep.lastName), false, false)
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have '.. doNumberFormat(points) ..' reputation points. You have ' .. getCreatureStorage(cid, rep.opinion) .. ' opinion points and you will gain one '.. (getCreatureStorage(cid, rep.opinion) > 0 and 'more ' or '') ..'in '.. rep.interval - getCreatureStorage(cid, rep.online) ..' minutes.'.. (getBooleanFromString(rep.usePower) and ' Your Rep Power is ' .. rep.getData(points)[3] ..'.' or '')..(name ~= nil and ' You last reputed ' .. name .. '.' or ''))

                if rep.getData(points)[4] ~= nil and getCreatureOutfit(cid).lookType ~= rep.getData(points)[4] then
                    doSetCreatureOutfit(cid, {lookType = rep.getData(points)[4]}, -1)
                    doSendAnimatedText(getThingPos(cid), rep.getData(points)[5], math.random(255))
                end
            end
            return true
        ]]>
    </talkaction>
           
    <talkaction words="!hail;!fuck" event="buffer">
        <![CDATA[
            domodlib('repSystem')               
            local target = getPlayerByNameWildcard(param)
           
            if not isPlayer(target) then
                return doPlayerSendCancel(cid, rep.alert[14]:format(param))
            end
                                           
            if getPlayerLevel(cid) < rep.minLevel then
                return doPlayerSendCancel(cid, rep.alert[15]:format(rep.minLevel))
            end
               
            if getPlayerIp(cid) == getPlayerIp(target) then
                return doPlayerSendCancel(cid, rep.alert[16])  
            end
            
            if not getBooleanFromString(rep.allowMultiRepByCommand) and getPlayerGUID(target) == getCreatureStorage(cid, rep.lastName) then
                return doPlayerSendCancel(cid, rep.alert[17])
            end
           
            if getCreatureStorage(cid, rep.opinion) < rep.required then
                return doPlayerSendCancel(cid, rep.alert[18])  
            end
                                                 
            doCreatureSetStorage(cid, rep.lastName, getPlayerGUID(target))
            doCreatureSetStorage(cid, rep.opinion, getCreatureStorage(cid, rep.opinion)-rep.required)
            doPlayerSendCancel(cid, rep.alert[19]:format(getCreatureName(target),getCreatureStorage(cid, rep.opinion)))
            if words == '!hail' then            
                return rep.add(target, getBooleanFromString(rep.usePower) and rep.getData(rep.getPoints(cid))[3] or rep.default, COLOR_LIGHTBLUE)
            elseif words == '!fuck' then
                return rep.remove(target, getBooleanFromString(rep.usePower) and rep.getData(rep.getPoints(cid))[3] or rep.default, COLOR_RED)
            end
        ]]>
    </talkaction>
</mod>
Revision 7.0 Update Log
======================>
-Two versions of system for TFS 0.4 and TFS 0.3.6
-New function rep.getData which displays rank, id, power, outfit and msg based on rep amount.
-Function rep.getPower deprecated, now is rep.getData(points)[3]
-Function rep.format for TFS 0.4 deprecated, using doNumberFormat of TFS
-/hail-/fuck-/set command script reduced.
-!hail-!fuck command script reduced.
-Config options values have been changed from boolean(true/false) to string(yes/no)
-New config option: rep.allowMultiRepByCommand
-New config option: rep.allowMultiRepByKill
-New config option: rep.allowRepInPvPTile
-New config setting: rep.default
-New config setting: rep.results
-Most system alert messages grouped into new rep.alert array
-Moved skull settings to main config.
-Moved monsters settings to main config.
-Fixed lastHit kill check for TFS 0.4
-Fixed PvP/hardcore tile
 
i got this =:)

[20/12/2010 16:35:16] > Loading rep.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/rep.xml
[20/12/2010 16:35:16] Line: 4, Info: Input is not proper UTF-8, indicate encoding !
[20/12/2010 16:35:16] Bytes: 0xA9 0x20 0x4F 0x54


[20/12/2010 16:35:16] failed!
 
Thanks, but now, when you kill a monster it dont give you rep, (demon, orshabaal....)
 
which MOD are you using? and which TFS?
 
Mod, the first page one (0.4), TFS= 0.3.6

Fixed it ^^
But thanks you rox
 
Last edited:
error

Code:
[22/12/2010 14:42:04] [Error - CreatureScript Interface] 
[22/12/2010 14:42:04] buffer:onKill
[22/12/2010 14:42:04] Description: 
[22/12/2010 14:42:04] [string "loadBuffer"]:10: attempt to call global 'getPVPOption' (a nil value)
[22/12/2010 14:42:04] stack traceback:
[22/12/2010 14:42:04] 	[string "loadBuffer"]:10: in function <[string "loadBuffer"]:9>
 
why it appears this picture?
reputationo.png
 
:/ weird, i have an unlimited account there
anyways I'll fix that in the incoming update
 
[14/01/2011 17:44:13] > Loading rep.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/rep.xml
[14/01/2011 17:44:13] Line: 3, Info: Input is not proper UTF-8, indicate encoding !
[14/01/2011 17:44:13] Bytes: 0xA9 0x20 0x4F 0x54


[14/01/2011 17:44:13] failed!
 
[14/01/2011 17:44:13] > Loading rep.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/rep.xml
[14/01/2011 17:44:13] Line: 3, Info: Input is not proper UTF-8, indicate encoding !
[14/01/2011 17:44:13] Bytes: 0xA9 0x20 0x4F 0x54


[14/01/2011 17:44:13] failed!

No, you've failed
remove the space '' before <?xml at the beginning of the MOD
 
Status
Not open for further replies.
Back
Top