Ir para conteúdo
  • 0

Dúvida- Sistema De Rep Em Ot


zani123

Pergunta

Ae Galera do Xtibia, eu e meu amigo passamos um OT 8.54 para 8.6, deu tudo certo.. mas esse OT tinha sistema de REP+... tipo, toda vez que alguém mata monstro, mata PK, PKliza, etc... perde ou ganha REP dependendo do caso (acho que vcs ja conhecem). Só que, quando eu passei pra 8.6, fica dando toda hora um erro no meu executável, segue ele:

 

[22/07/2010 17:03:33] OTSYS_SQLITE3_PREPARE(): SQLITE ERROR: no such column: rep (UPDATE "players" SET "rep" = 15 WHERE "id" = 40;)

[22/07/2010 17:03:33] Error during getDataInt(rep).

 

Pelo o que eu entendi, eu acho que o script não consegue encontrar a coluna REP na seção PLAYERS.

 

Alguém poderia me ajudar? Eu ja tentei tirar esse sistema da pasta Creaturescripts mas msm assim da o mesmo erro.. e ainda quando eu do look nos players, aparece aqueles ranks do sistema de REP, exemplo:

 

You see BLABLABLABLA...

 

BLABLABLA is (Noob (======|======))

 

[algo assim]

 

Então..o que eu teria que fazer pra arrumar esse sistema? Alguma coisa na database? Alugém me ajuda por favor..

 

OBS: Eu encontrei um arquivo na pasta "mods" localizada na pasta principal do OT. Nela eu achei o arquivo rep_system (é .txt), e nele tem:

 

 

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

<!-- NECESSARY SQL QUERY FOR THE REP 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";

-->

<mod name="TheBestReputationSystem for TFS CryingDamsons

CREDITS:

-Darkkhaos (sql queries)

-Colandus (timestring function)

-Sync (repsystem talkaction)

-Shawak (highscore)

-Absolute Mango (php)

And me! I must say that these people didn't help me directly, I just fixed their

scripts to fit them on my sys, some of them had unnecessary codes.

the rep functions, the remaining scripts, the idea and the sys is 100% by me."

 

version="4.0 patch #4" author="Cybermaster" contact="otland.net" 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)

local ranks = {

{-5000, "Power Abuser (***==========)"},

{-2000, "Evil (=**==========)"},

{-1500, "Gangster (==*==========)"},

{-1000, "Villain (===|=========)"},

{-500, "PK (====|========)"},

{-300, "Bad Guy (======|======)"},

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

{300, "Well-Known (=======|=====)"},

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

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

{1500, "The Best (==========+==)"},

{2000, "Hero (==========++=)"},

{5000, "Legendary Hero (==========+++)"}

}

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

return ranks[1][2]

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, "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="kill" name="repKill" event="script"><![CDATA[

domodlib('repFunctions')

function onKill(cid, target, lastHit)

local SKULL = {[sKULL_WHITE] = 15, [sKULL_RED] = 30, [sKULL_BLACK] = 45, [sKULL_NONE] = -30}

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

if getPlayerLevel(target) > 30 then

doSendAnimatedText(getPlayerPosition(cid), "-REP", TEXTCOLOR_RED)

setPlayerRep(cid, getRepPoints(cid)+SKULL[getPlayerSkullType(target)])

end

end

if (isPlayer(cid)) and (isPlayer(target)) then

if getRepPoints(target) == 0 then

return true

elseif getRepPoints(target) > 0 then

removePlayerRep(target, 5, TEXTCOLOR_RED)

else

addPlayerRep(target, 5, TEXTCOLOR_RED)

end

end

return true

end]]></event>

 

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

domodlib('repFunctions')

-- >>> To add a new monster, copy a line inside the 'monsters' table<<< --

function onKill(cid, target, lastHit)

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

return true

end

 

local monsters = {

["behemoth"] = {rep = 3},

["hellfire fighter"] = {rep = 5},

["orshabaal"] = {rep = 15},

}

local monster = monsters[getCreatureName(target)]

 

if monster then

addPlayerRep(cid, monster.rep, TEXTCOLOR_LIGHTGREEN)

end

return true

end]]></event>

 

<talkaction log= "yes" words="/hail; /fuck; /set" access="3" 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="/highscores" 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="!highscores" 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>

 

 

 

 

 

Aguardo respostas.

Obrigado.

Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

Não existe a coluna na database. Execute a query de acordo com o tipo de sua database:

 

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

 

 

flw

Link para o comentário
Compartilhar em outros sites

  • 0

Não existe a coluna na database. Execute a query de acordo com o tipo de sua database:

 

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

 

 

flw

 

Entendi, ja executei a query no mysql e nao funfou. O erro continua aparecendo. E agora?

Editado por zani123
Link para o comentário
Compartilhar em outros sites

  • 0

Caso seu ot seja sqlite, tem que abrir o sqlite editor e criar a tabela rep com as configurações:

 

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

 

Caso tenha alguma opção de executar query, coloque a query acima e execute.

 

Caso seu ot seja mysql, entre no localhost pelo site: http://localhost/phpmyadmin e selecione sua database à direita. Vá em sql, cole a query abaixo e clique em executar:

 

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

 

 

flw

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...