Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Nome do scrip: Sistema de Reputação (rep look, by: vodkart)

Tipo do Script: creaturescripts.

Versão Utilizada: 8.6.

Servidor Utilizado: the forgotten server.

Nível de Experiência: Intermediário.

Informações Extras: Nesse script feito por Vodkart, serve para quando dar look em um player apareçer os pontos de reputação q ele tem.. so que quando da look nao apareçe nada...

nome do seu script.lua

function getReps(cid)

return getPlayerStorageValue(cid,102086) < 0 and 0 or getPlayerStorageValue(cid,102086)

end

function onLook(cid, thing, position, lookDistance)

if isPlayer(thing.uid) then

doPlayerSetSpecialDescription(thing.uid, "\n[Reps: " .. getReps(thing.uid) .."]")

end

return true

end

creaturescript.xml

<event type="look" name="showRep" event="script" value="nome do seu script.lua"/>

creaturescript/script/login.lua adc:

registerCreatureEvent(cid, "showRep")

AKI O SISTEMA INTEIRO Q ESTOU USANDO:

Primeiro vai em "data/creaturescripts/scripts/" duplica um arquivo dessa pasta e renomeia para "repsystem" sem as aspas, nele cole:

--<Script by jhon992>--

function onKill(cid, target, lastHit)

vetMonster = { "Demon", "Morgaroth", "Hydra", "Dragon" } -- adicionar monstros que darão rep+

-- Ao matar monstros do vetMonster, ganhara rep+.

for i=0, #vetMonster do

if (getCreatureName(target) == vetMonster) then

setPlayerStorageValue(cid, 102086, getPlayerStorageValue(cid, 102086)+1)

doSendAnimatedText(getThingPos(cid), 'Rep+', 30)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"Você ganhou 1 ponto de reputação por matar um "..vetMonster..".")

return TRUE

end

end

-- Ao matar um pk, ganhara rep+.

if (isPlayer(target) == true) then

if (getCreatureSkullType(target) > 2) then

setPlayerStorageValue(cid, 102086, getPlayerStorageValue(cid, 102086)+1)

doSendAnimatedText(getThingPos(cid), 'Rep+', 30)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"Você ganhou 1 ponto de reputação por matar "..getCreatureName(target)..".")

return TRUE

end

-- Ao matar um player normal, ganhara rep-.

setPlayerStorageValue(cid, 102086, getPlayerStorageValue(cid, 102086)-1)

doSendAnimatedText(getThingPos(cid), 'Rep-', 144)

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"Você perdeu 1 ponto de reputação por matar "..getCreatureName(target)..".")

return TRUE

end

return TRUE

end

Agora em "data/creaturescripts/creaturescripts.xml" cole a tag:

<event type="kill" name="RepSystem" event="script" value="repsystem.lua"/>

Entre na pasta "data/creaturescripts/scripts" novamente, e abra o arquivo "login.lua" sem as aspas. Nele cole a tag:

-- Verificar se é primeira vez que loga, pois ao usar storage ele ja começa com -1,

-- Então vamos zera-lo para que sua Reputação comece do 0.

if (getPlayerStorageValue(cid, 102087) ~= 1) then

setPlayerStorageValue(cid, 102087, 1)

setPlayerStorageValue(cid, 102086, 0)

end

registerCreatureEvent(cid, "RepSystem")

Terminamos a parte do Sistema e agora vamos para o talkaction de rank.

Vai na pasta "data/talkaction/scripts", duplique um arquivo e remomeie para "rankrep" sem as aspas. Abra-o e cole:

function getPlayerNameByGUID2(n)

local c = db.getResult("SELECT `name` FROM `players` WHERE `id` = "..n..";")

if c:getID() == -1 then

return "SQL_ERROR["..n.."]"

end

return c:getDataString("name")

end

function onSay(cid, words, param)

if (param == "") then

doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT,"Você possui "..getPlayerStorageValue(cid, 102086).." pontos de Reputação.")

return TRUE

end

if (param == "rank") then

local max = 50

local letters_to_next = 50

local name_now

local name = "Highscore for Reputação\n"

local rkn = 0

local no_break = 0

name = name.."\n"

name = name.."Rank. Pontos | Nome do Jogador\n"

local v = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = 102086 ORDER BY cast(value as INTEGER) DESC;")

local kk = 0

repeat

if kk == max or v:getID() == -1 then

break

end

kk = kk+1

name_now, l = getPlayerNameByGUID2(v:getDataInt("player_id")), string.len(getPlayerNameByGUID2(v:getDataInt("player_id")))

space = ""

for i=1, letters_to_next-l do

space = space.." "

end

if name_now == nil then

name_now = 'sql error['..v:getDataInt("player_id")..']'

end

name = name..kk..". "..v:getDataInt("value").." | "..name_now..space.." \n"

until v:next() == false

if name ~= "Highscore\n" then

doPlayerPopupFYI(cid, name)

end

return TRUE

else

doPlayerSendCancel(cid, "Command valid: !rep, !rep rank.")

return TRUE

end

end

E por último mais não menos importante, abra "data/talkactions/talkacitons.xml" e cole a tag:

<talkaction words="!rep" event="script" value="rankrep.lua"/>

Pronto, terminamos o nosso Simple Reputation System! yipi.gif

Editado por MonsterOt (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

use esse sistema aqui::

vai na pasta mod e cria um arquivo chamado rep_system

<?xml version="1.0" encoding="UTF-8"?>

<mod name="Reputation System" enabled="yes">

<config name="repSystem"><![CDATA[

rep = {

--[[ GLOBAL CONFIG ]]--

interval = 6 * 60 * 60, --This is [6] hours, in seconds. Time between rep.

lastTime = 5136, --Used to store the player's last Rep Timestamp

lastName = 5138, --Used to store the last repped's GUID

minLevel = 20, --From this level onwards player can use commands

pvpLevel = 30, --Minimum level for PVP Rep'ing

skull = {4,5}, --these skulled player won't receive rep when killing

getArticle = function(cid, uppercase)

return getPlayerSex(cid) == 0 and (uppercase and 'S' or 's') ..'he' or (uppercase and 'H' or 'h') ..'e'

end,

getPoints = function(cid)

local Info = db.getResult("SELECT `rep` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")

local rep = Info:getDataInt("rep")

Info:free()

return rep

end,

getPower = function(points)

local power = {{0,2},{300,3},{500,4},{1000,5},{1500,6},{2000,8}, {5000,10}}

table.sort(power, function(a, b) return a[1] > b[1] end)

for _, t in ipairs(power) do

if(math.abs(points) >= t[1]) then

return t[2]

end

end

return power[1][2]

end,

getRank = function(points)

local ranks = {

{-5000, 'Power Abuser (+============)'},

{-2000, 'Evil (=|===========)'},

{-1500, 'Slayer (==|==========)'},

{-1000, 'Killer (===|=========)'},

{-500, 'Villain (====|========)'},

{-300, 'Creeping (=====|=======)'},

{-299, 'Noob (======|======)'},

{300, 'Avowed (=======|=====)'},

{500, 'Popular (========|====)'},

{1000, 'Hailed (=========|===)'},

{1500, 'Acclaimed (==========|==)'},

{2000, 'Hero (===========|=)'},

{5000, 'Legend (============+)'},

}

if points > -1 then

table.sort(ranks, function(a, b) return a[1] > b[1] end)

for _, t in ipairs(ranks) do if points >= t[1] then return t[2] end end

else

table.sort(ranks, function(a, b) return a[1] < b[1] end)

for _, t in ipairs(ranks) do if points <= t[1] then return t[2] end end

end

return ranks[1][2]

end,

set = function(cid, points)

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(getCreaturePosition(cid), '+REP', color)

doPlayerSendCancel(cid,'You have just been hailed and gained '.. amount ..' reputation points.')

end,

remove = function(cid, amount, color)

db.executeQuery("UPDATE `players` SET `rep` = `rep` - " .. amount .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")

doSendAnimatedText(getCreaturePosition(cid), '-REP', color)

doPlayerSendCancel(cid,'You have just been repudiated and lost '.. amount ..' reputation points.')

end,

getTime = function(timeDiff)

local dateFormat = {

{'h', timeDiff / 60 / 60 % 6},

{'m', timeDiff / 60 % 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 '' or ' and ') .. v .. '' .. t[1])

end

end

return table.concat(out)

end,

formatNum = function(str, sep)

str = tostring(str):reverse()

str = str:gsub("(%d)(%d)(%d)", '%1%2%3' .. (sep or " "), math.ceil(str:len() / 3)-1)

return str:reverse()

end,

}]]>

</config>

<event type="login" name="repRegister" event="script"><![CDATA[

function onLogin(cid)

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) then

doPlayerSetSpecialDescription(thing.uid,'.\n' .. (thing.uid == cid and 'He are' or rep.getArticle(thing.uid, true) .. ' is') .. ' ' .. rep.getRank(rep.getPoints(thing.uid)))

end

return true

end]]>

</event>

<event type="kill" name="repKill" event="script"><![CDATA[

domodlib('repSystem')

local t = {

[sKULL_WHITE] = 30,

[sKULL_RED] = 45,

[sKULL_BLACK] = 45,

[sKULL_NONE] = -30,

}

function onKill(cid, target, lastHit)

if isPlayer(cid) and isPlayer(target) then

--THE KILLER

if isInArray({0,3,4,5}, getCreatureSkullType(target)) then

if getPlayerLevel(target) >= rep.pvpLevel and not isInArray(rep.skull, getCreatureSkullType(cid)) then

doSendAnimatedText(getCreaturePosition(cid), getCreatureSkullType(target) == 0 and '-REP' or '+REP', math.random(1,255))

rep.set(cid, rep.getPoints(cid)+t[getCreatureSkullType(target)])

doPlayerSendTextMessage(cid, 20, 'You '.. (getCreatureSkullType(target) == 0 and 'lose' or 'gain') ..' reputation because you killed a player.')

end

end

--THE VICTIM

if rep.getPoints(target) == 0 then

return true

elseif rep.getPoints(target) > 0 then

rep.remove(target, 5, TEXTCOLOR_RED)

doPlayerSendTextMessage(target, 20, 'You lose reputation because you were killed by a player.')

else

rep.add(target, 5, TEXTCOLOR_LIGHTBLUE)

doPlayerSendTextMessage(target, 20, 'You lose reputation because you were killed by a player.')

end

end

return true

end]]>

</event>

<event type="kill" name="repMonster" event="script"><![CDATA[

domodlib('repSystem')

function onKill(cid, target, lastHit)

if not isPlayer(cid) or not isMonster(target) then

return true

end

local monsters = {

["behemoth"] = 0,

["hellfire fighter"] = 0,

}

local name = getCreatureName(target)

local monster = monsters[string.lower(name)]

if monster then

rep.add(cid, monsters[string.lower(getCreatureName(target))], TEXTCOLOR_LIGHTBLUE)

end

return true

end]]>

</event>

<talkaction log= "yes" words="/hail;/fuck;/set" access="4" event="buffer"><![CDATA[

domodlib('repSystem')

if param == '' then

doPlayerSendCancel(cid,'You must write a player\'s name.')

return true

end

local t = string.explode(param, ',')

local tid = getPlayerByName(t[1])

if not isPlayer(tid) then

doPlayerSendCancel(cid, 'Player ' .. param .. ' not found or is not online.')

return true

end

if not t[2] and isPlayer(tid) then

if words == '/hail' then

rep.add(tid, 5, TEXTCOLOR_TEAL)

doPlayerSendCancel(cid, 'You added +5 rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

if words == '/fuck' then

rep.remove(tid, 5, TEXTCOLOR_RED)

doPlayerSendCancel(cid, 'You removed -5 rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

end

if t[2] and isInArray({'/set','/hail','fuck'}, words) then

if not tonumber(t[2]) then

doPlayerSendCancel(cid, 'Reputation amount is invalid.')

return true

end

end

if words == '/hail' then

rep.add(tid, t[2], TEXTCOLOR_TEAL)

doPlayerSendCancel(cid, 'You added ' .. t[2] .. ' rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

if words == '/fuck' then

rep.remove(tid, t[2], TEXTCOLOR_RED)

doPlayerSendCancel(cid, 'You removed ' .. t[2] .. ' rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

if t[2] and words == '/set' then

rep.set(tid, t[2])

doPlayerSendCancel(cid, 'You have set ' .. getPlayerName(tid) .. '\'s points to ' .. rep.getPoints(tid))

else

doPlayerSendCancel(cid, 'Absolute reputation amount not specified.')

return true

end

if not t[2] then

doPlayerSendCancel(cid, 'Absolute reputation amount not specified.')

return true

end

return true]]>

</talkaction>

<talkaction words="!ranks" event="buffer"><![CDATA[

domodlib('repSystem')

local players = 10

local str, value, name, result = "","","",0,nil

if isInArray({'hero','pos','1','+'}, param) then

str,value,name = "[#]-[Name]-[Points]-[Rank]\n--[Positive Rep Highscores]--\n","rep","name"

result = db.getResult("SELECT `name`, `rep` FROM `players` WHERE `rep` > -1 AND `id` > 6 AND `group_id` < 2 ORDER BY `rep` DESC, `name` ASC;")

elseif isInArray({'evil','neg','2','-'}, param) then

str,value,name = "[#]-[Name]-[Points]-[Rank]\n--[Negative Rep Highscores]--\n","rep","name"

result = db.getResult("SELECT `name`, `rep` FROM `players` WHERE `rep` < 0 AND `id` > 6 AND `group_id` < 2 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) .. "] - " .. rep.getRank(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('repSystem')

local points, lastName, action = rep.getPoints(cid), getPlayerStorageValue(cid, rep.lastName), false

doPlayerSendTextMessage(cid, 19, 'You have ' .. rep.formatNum(points, ",") .. ' reputation points. You are ' .. rep.getRank(points) .. '\nYour Rep Power is ' .. rep.getPower(points) ..'. ' .. (getPlayerStorageValue(cid, rep.lastName) ~= -1 and 'You last reputed ' .. getPlayerNameByGUID(lastName) .. '.' or ''))

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 > 2499 then --rep++ cm outfit

disguise, text, action = {lookType = 306}, "Legend!!", true

elseif points > 1499 then --rep+ hero outfit

disguise, text, action = {lookType = 73}, "Hero!!", true

elseif points < -4999 and getPlayerSex(cid) == 0 then --rep*** female outfit

disguise, text, action = {lookType = 312}, "DarkLord!!", true

elseif points < -4999 and getPlayerSex(cid) > 0 then --rep*** male outfit

disguise, text, action = {lookType = 287}, "DarkLord!!", true

elseif points < -2499 then --rep** pig outfit --

disguise, text, action = {lookType = 300}, "Morte!!", true

elseif points < -1499 then --rep* orc outfit --

disguise, text, action = {lookType = 194}, "Gangster!!", true

end

if action and getCreatureOutfit(cid).lookType ~= disguise.lookType then

doSetCreatureOutfit(cid, disguise, -1)

doSendAnimatedText(getCreaturePosition(cid), text, math.random(1,255))

return true

end

return true]]>

</talkaction>

<talkaction words="!hail;!fuck" event="buffer"><![CDATA[

domodlib('repSystem')

if param == '' then

doPlayerSendCancel(cid, 'Command requires a player\'s name.')

return true

end

local target, oldTime = getPlayerByName(param), getPlayerStorageValue(cid, rep.lastTime)

if not isPlayer(target) then

doPlayerSendCancel(cid, 'That player does not exist or is offline.')

return true

end

if oldTime == -1 then

setPlayerStorageValue(cid, rep.lastTime, os.time())

end

if getPlayerLevel(cid) < rep.minLevel then

doPlayerSendCancel(cid,'You may repute from level ' .. rep.minLevel ..' onwards.')

return true

end

if getPlayerGUID(target) == getPlayerStorageValue(cid, rep.lastName) then

doPlayerSendCancel(cid, 'You may not repute that player two times in a row.')

return true

end

if (os.time() - oldTime) < rep.interval then

doPlayerSendCancel(cid, 'You may repute in ' .. rep.getTime(oldTime - os.time()) .. ' [' .. os.date("%b.%d %X", oldTime + rep.interval) ..']')

return true

end

if getPlayerIp(cid) == getPlayerIp(target) then

doPlayerSendCancel(cid, 'You may not repute neither yourself nor someone in your IP.')

return true

end

if words == '!hail' then

setPlayerStorageValue(cid, rep.lastName, getPlayerGUID(target))

rep.add(target, rep.getPower(cid), TEXTCOLOR_LIGHTBLUE)

setPlayerStorageValue(cid, rep.lastTime, os.time())

doPlayerSendCancel(cid, 'You have just reputed ' .. getCreatureName(target))

elseif words == '!fuck' then

setPlayerStorageValue(cid, rep.lastName, getPlayerGUID(target))

rep.remove(target, rep.getPower(cid), TEXTCOLOR_RED)

setPlayerStorageValue(cid, rep.lastTime, os.time())

doPlayerSendCancel(cid, 'You have just reputed ' .. getCreatureName(target))

end

return true]]>

</talkaction>

</mod>

Link para o post
Compartilhar em outros sites

@vodkart

sim, eu lembro que antes dava pra dar look em si mesmo e ver quantos rep tem.

@mariatti

nao é bem isso que quero. quero q so apareça [rep "numero de reps"] quando um player der look em vc

to usando esse rep_system:

<?xml version="1.0" encoding="UTF-8"?>

<!-- NECESSARY SQL QUERY FOR THE REPUTATION SYSTEM

MySQL: ALTER TABLE `players` ADD `rep` INT( 11 ) NOT NULL DEFAULT '0';

SQLite: ALTER TABLE "players" ADD "rep" INT( 11 ) NOT NULL DEFAULT "0";

CREDITS: Sync.darkhaos.Colandus.Shawak.Absolute Mango.nsanee -->

<mod name="Cyber's REPutation System" revision="5.0" author="Cybermaster" contact="otland.net" enabled="yes">

<config name="repSystem"><![CDATA[

rep = {

--[[ GLOBAL CONFIG ]]--

interval = 6 * 60 * 60, --This is [6] hours, in seconds. Time between rep.

lastTime = 5136, --Used to store the player's last Rep Timestamp

lastName = 5138, --Used to store the last repped's GUID

minLevel = 20, --From this level onwards player can use commands

pvpLevel = 30, --Minimum level for PVP Rep'ing

skull = {4,5}, --these skulled player won't receive rep when killing

getArticle = function(cid, uppercase)

return getPlayerSex(cid) == 0 and (uppercase and 'S' or 's') ..'he' or (uppercase and 'H' or 'h') ..'e'

end,

getPoints = function(cid)

local Info = db.getResult("SELECT `rep` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";")

local rep = Info:getDataInt("rep")

Info:free()

return rep

end,

getPower = function(points)

local power = {{0,2},{300,3},{500,4},{1000,5},{1500,6},{2000,8},{5000,10}}

table.sort(power, function(a, b) return a[1] > b[1] end)

for _, t in ipairs(power) do

if(math.abs(points) >= t[1]) then

return t[2]

end

end

return power[1][2]

end,

getRank = function(points)

local ranks = {

{-5000, 'Power Abuser (*<<==========)'},

{-2000, 'Evil (=*<==========)'},

{-1500, 'Slayer (==*==========)'},

{-1000, 'Killer (===|=========)'},

{-500, 'Villain (====|========)'},

{-300, 'Creeping (======|======)'},

{-299, 'Unknown (======|======)'},

{300, 'Avowed (=======|=====)'},

{500, 'Popular (========|====)'},

{1000, 'Hailed (=========|===)'},

{1500, 'Acclaimed (==========+==)'},

{2000, 'Hero (==========>+=)'},

{5000, 'Legend (==========>>+)'},

}

if points > -1 then

table.sort(ranks, function(a, b) return a[1] > b[1] end)

for _, t in ipairs(ranks) do if points >= t[1] then return t[2] end end

else

table.sort(ranks, function(a, b) return a[1] < b[1] end)

for _, t in ipairs(ranks) do if points <= t[1] then return t[2] end end

end

return ranks[1][2]

end,

set = function(cid, points)

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(getCreaturePosition(cid), '+REP', color)

doPlayerSendCancel(cid,'You have just been hailed and gained '.. amount ..' reputation points.')

end,

remove = function(cid, amount, color)

db.executeQuery("UPDATE `players` SET `rep` = `rep` - " .. amount .. " WHERE `id` = " .. getPlayerGUID(cid) .. ";")

doSendAnimatedText(getCreaturePosition(cid), '-REP', color)

doPlayerSendCancel(cid,'You have just been repudiated and lost '.. amount ..' reputation points.')

end,

getTime = function(timeDiff)

local dateFormat = {

{'h', timeDiff / 60 / 60 % 6},

{'m', timeDiff / 60 % 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 '' or ' and ') .. v .. '' .. t[1])

end

end

return table.concat(out)

end,

formatNum = function(str, sep)

str = tostring(str):reverse()

str = str:gsub("(%d)(%d)(%d)", '%1%2%3' .. (sep or " "), math.ceil(str:len() / 3)-1)

return str:reverse()

end,

}]]>

</config>

<event type="login" name="repRegister" event="script"><![CDATA[

function onLogin(cid)

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) then

doPlayerSetSpecialDescription(thing.uid,'.\n' .. (thing.uid == cid and 'You are' or rep.getArticle(thing.uid, true) .. ' is') .. ' ' .. rep.getRank(rep.getPoints(thing.uid)))

end

return true

end]]>

</event>

<event type="kill" name="repKill" event="script"><![CDATA[

domodlib('repSystem')

local t = {

[sKULL_WHITE] = 15,

[sKULL_RED] = 30,

[sKULL_BLACK] = 45,

[sKULL_NONE] = -30,

}

function onKill(cid, target, lastHit)

if isPlayer(cid) and isPlayer(target) then

--THE KILLER

if isInArray({0,3,4,5}, getCreatureSkullType(target)) then

if getPlayerLevel(target) >= rep.pvpLevel and not isInArray(rep.skull, getCreatureSkullType(cid)) then

doSendAnimatedText(getCreaturePosition(cid), getCreatureSkullType(target) == 0 and '-REP' or '+REP', math.random(1,255))

rep.set(cid, rep.getPoints(cid)+t[getCreatureSkullType(target)])

doPlayerSendTextMessage(cid, 20, 'You '.. (getCreatureSkullType(target) == 0 and 'lose' or 'gain') ..' reputation because you killed a player.')

end

end

--THE VICTIM

if rep.getPoints(target) == 0 then

return true

elseif rep.getPoints(target) > 0 then

rep.remove(target, 5, TEXTCOLOR_RED)

doPlayerSendTextMessage(target, 20, 'You lose reputation because you were killed by a player.')

else

rep.add(target, 5, TEXTCOLOR_LIGHTBLUE)

doPlayerSendTextMessage(target, 20, 'You lose reputation because you were killed by a player.')

end

end

return true

end]]>

</event>

<event type="kill" name="repMonster" event="script"><![CDATA[

domodlib('repSystem')

function onKill(cid, target, lastHit)

if not isPlayer(cid) or not isMonster(target) then

return true

end

local monsters = {

["demon"] = 3,

["behemoth"] = 4,

["hellfire fighter"] = 5,

["orshabaal"] = 10,

}

local name = getCreatureName(target)

local monster = monsters[string.lower(name)]

if monster then

rep.add(cid, monsters[string.lower(getCreatureName(target))], TEXTCOLOR_LIGHTBLUE)

end

return true

end]]>

</event>

<talkaction log= "yes" words="/hail;/fuck;/set" access="4" event="buffer"><![CDATA[

domodlib('repSystem')

if param == '' then

doPlayerSendCancel(cid,'You must write a player\'s name.')

return true

end

local t = string.explode(param, ',')

local tid = getPlayerByName(t[1])

if not isPlayer(tid) then

doPlayerSendCancel(cid, 'Player ' .. param .. ' not found or is not online.')

return true

end

if not t[2] and isPlayer(tid) then

if words == '/hail' then

rep.add(tid, 5, TEXTCOLOR_TEAL)

doPlayerSendCancel(cid, 'You added +5 rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

if words == '/fuck' then

rep.remove(tid, 5, TEXTCOLOR_RED)

doPlayerSendCancel(cid, 'You removed -5 rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

end

if t[2] and isInArray({'/set','/hail','fuck'}, words) then

if not tonumber(t[2]) then

doPlayerSendCancel(cid, 'Reputation amount is invalid.')

return true

end

end

if words == '/hail' then

rep.add(tid, t[2], TEXTCOLOR_TEAL)

doPlayerSendCancel(cid, 'You added ' .. t[2] .. ' rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

if words == '/fuck' then

rep.remove(tid, t[2], TEXTCOLOR_RED)

doPlayerSendCancel(cid, 'You removed ' .. t[2] .. ' rep points to ' .. getPlayerName(tid) .. ', and now ' .. rep.getArticle(tid, false) .. ' has ' .. rep.getPoints(tid) .. ' points.')

return true

end

if t[2] and words == '/set' then

rep.set(tid, t[2])

doPlayerSendCancel(cid, 'You have set ' .. getPlayerName(tid) .. '\'s points to ' .. rep.getPoints(tid))

else

doPlayerSendCancel(cid, 'Absolute reputation amount not specified.')

return true

end

if not t[2] then

doPlayerSendCancel(cid, 'Absolute reputation amount not specified.')

return true

end

return true]]>

</talkaction>

<talkaction words="!ranks" event="buffer"><![CDATA[

domodlib('repSystem')

local players = 10

local str, value, name, result = "","","",0,nil

if isInArray({'hero','pos','1','+'}, param) then

str,value,name = "[#]-[Name]-[Points]-[Rank]\n--[Positive Rep Highscores]--\n","rep","name"

result = db.getResult("SELECT `name`, `rep` FROM `players` WHERE `rep` > -1 AND `id` > 6 AND `group_id` < 2 ORDER BY `rep` DESC, `name` ASC;")

elseif isInArray({'evil','neg','2','-'}, param) then

str,value,name = "[#]-[Name]-[Points]-[Rank]\n--[Negative Rep Highscores]--\n","rep","name"

result = db.getResult("SELECT `name`, `rep` FROM `players` WHERE `rep` < 0 AND `id` > 6 AND `group_id` < 2 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) .. "] - " .. rep.getRank(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('repSystem')

local points, lastName, action = rep.getPoints(cid), getPlayerStorageValue(cid, rep.lastName), false

doPlayerSendTextMessage(cid, 19, 'You have ' .. rep.formatNum(points, ",") .. ' reputation points. You are ' .. rep.getRank(points) .. '\nYour Rep Power is ' .. rep.getPower(points) ..'. ' .. (getPlayerStorageValue(cid, rep.lastName) ~= -1 and 'You last reputed ' .. getPlayerNameByGUID(lastName) .. '.' or ''))

if points > 4999 then --female rep+++ queen outfit

disguise, text, action = (getPlayerSex(cid) == 0 and {lookType = 331} or {lookType = 332}), (getPlayerSex(cid) == 0 and 'Queen!!' or 'King!!'), true

elseif points > 1999 then --rep++ cm outfit

disguise, text, action = {lookType = 73}, 'Hero!!', true

elseif points > 1499 then --rep+ hero outfit

disguise, text, action = {lookType = 63}, 'Acclaimed!!', true

elseif points < -4999 then --rep*** devil outfit

disguise, text, action = {lookType = 334}, 'P.O.!', true

elseif points < -1999 then --rep** pig outfit

disguise, text, action = {lookType = 306}, 'Evil!!', true

elseif points < -1499 then --rep* orc outfit

disguise, text, action = {lookType = 5}, "Slayer!!", true

end

if action and getCreatureOutfit(cid).lookType ~= disguise.lookType then

doSetCreatureOutfit(cid, disguise, -1)

doSendAnimatedText(getCreaturePosition(cid), text, math.random(1,255))

return true

end

return true]]>

</talkaction>

<talkaction words="!hail;!fuck" event="buffer"><![CDATA[

domodlib('repSystem')

if param == '' then

doPlayerSendCancel(cid, 'Command requires a player\'s name.')

return true

end

local target, oldTime = getPlayerByName(param), getPlayerStorageValue(cid, rep.lastTime)

if not isPlayer(target) then

doPlayerSendCancel(cid, 'That player does not exist or is offline.')

return true

end

if oldTime == -1 then

setPlayerStorageValue(cid, rep.lastTime, os.time())

end

if getPlayerLevel(cid) < rep.minLevel then

doPlayerSendCancel(cid,'You may repute from level ' .. rep.minLevel ..' onwards.')

return true

end

if getPlayerGUID(target) == getPlayerStorageValue(cid, rep.lastName) then

doPlayerSendCancel(cid, 'You may not repute that player two times in a row.')

return true

end

if (os.time() - oldTime) < rep.interval then

doPlayerSendCancel(cid, 'You may repute in ' .. rep.getTime(oldTime - os.time()) .. ' [' .. os.date("%b.%d %X", oldTime + rep.interval) ..']')

return true

end

if getPlayerIp(cid) == getPlayerIp(target) then

doPlayerSendCancel(cid, 'You may not repute neither yourself nor someone in your IP.')

return true

end

if words == '!hail' then

setPlayerStorageValue(cid, rep.lastName, getPlayerGUID(target))

rep.add(target, rep.getPower(cid), TEXTCOLOR_LIGHTBLUE)

setPlayerStorageValue(cid, rep.lastTime, os.time())

doPlayerSendCancel(cid, 'You have just reputed ' .. getCreatureName(target))

elseif words == '!fuck' then

setPlayerStorageValue(cid, rep.lastName, getPlayerGUID(target))

rep.remove(target, rep.getPower(cid), TEXTCOLOR_RED)

setPlayerStorageValue(cid, rep.lastTime, os.time())

doPlayerSendCancel(cid, 'You have just reputed ' .. getCreatureName(target))

end

return true]]>

</talkaction>

</mod>

Editado por MonsterOt (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

tenta assim

function getReps(cid)

return getPlayerStorageValue(cid,102086) < 0 and 0 or getPlayerStorageValue(cid,102086)

end

function onLook(cid, thing, position, lookDistance)

if isPlayer(thing.uid) then

doPlayerSetSpecialDescription(thing.uid, "\n[Reps: " .. getReps(thing.uid == cid and cid or thing.uid) .."]")

end

return true

end

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

antes quando eu usava um outro rep_system nos mods apareçia esse erro:

Error during getDataInt(rep)

1º) Abra sua DATABASE no SQLITE.

2º) Vá em TOOLS

3º) Siga em OPEN SQL QUERY EDITOR

4º) Coloque na 1º linha a seguinte query:

ALTER TABLE "players" ADD "rep" INT( 11 ) NOT NULL DEFAULT "0";

5º) Aperte F9.

Editado por mariatti (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
1º) Abra sua DATABASE no SQLITE.

2º) Vá em TOOLS

3º) Siga em OPEN SQL QUERY EDITOR

4º) Coloque na 1º linha a seguinte query:

ALTER TABLE "players" ADD "rep" INT( 11 ) NOT NULL DEFAULT "0";

5º) Aperte F9.

deu esse error:

Error while executing query: duplicate column name: rep

acho que quer dizer q ja tem uma linhas dessa..

mas oque eu faço com o rep_system no mods? nao pode ser alguma coisa la?

olha esse post que foi resolvido com o mesmo tema, so que nao consegui fazer funfar o look rep:

http://tibiaking.com/forum/topic/12733-resolvido-pedido-look-rep/

Editado por MonsterOt (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

consegui ! rep + para todos

oque eu fiz foi deletar o rep_system no mods, e add tudo de novo o sistema de rep , com o look do vodkart e deu certo!

Editado por MonsterOt (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

aqui ta funcionando cara....

copia direitinho o script : http://tibiaking.com/forum/topic/15555-perfect-rep-system/

ve se nao tem otro systema de rep... na pasta data..

image: http://imageshack.us/photo/my-images/802/65249328.jpg/

Link para o post
Compartilhar em outros sites

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo