Postado Abril 18, 2016 9 anos Olá amigos, estou com um problema, peguei um script que mostra algumas informações no look e tentei aumentar um pouco... Coloquei um sistema de reputação e criei uma tabela.. "rep" em "accounts" na database. Após isso criei este script encima de outro: function onLook(cid, thing, position, lookDistance) function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d end getPoints = function(cid) local Info = db.getResult("SELECT `rep` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";") local s = Info:getDataInt("s") Info:free() return s end if s <= -20 then x = "GranBigNoob" elseif s <= -10 then x = "Big Noob" elseif s <= -1 then x = "Noob" elseif s == 0 then x = "Citizen" elseif s >= 1 then x = "Avowed" elseif s >= 10 and s < 20 then x = "Respected" elseif s >= 20 and s < 30 then x = "Sagaz" elseif s >= 30 and s < 40 then x = "Domination" elseif s >= 40 and s < 20 then x = "Bloodbath" elseif s >= 50 then x = "Legendary" end if isPlayer(thing.uid) then doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." ja Matou: ["..getDeathsAndKills(thing.uid, "kill").."] Players. \n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." ja Morreu: ["..getDeathsAndKills(thing.uid, "death").."] Vezes.\nReputação: "..s.." ("..x..") " ) end return true end O PROBLEMA: [8/4/2016 17:32:15] [Error - CreatureScript Interface] [8/4/2016 17:32:15] data/creaturescripts/scripts/lawl.lua:onLook [8/4/2016 17:32:15] Description: [8/4/2016 17:32:15] data/creaturescripts/scripts/lawl.lua:20: attempt to compare nil with number [8/4/2016 17:32:16] stack traceback: [8/4/2016 17:32:16] data/creaturescripts/scripts/lawl.lua:20: in function <data/creaturescripts/scripts/lawl.lua:1>
Postado Abril 20, 2016 9 anos function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d 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 function onLook(cid, thing, position, lookDistance) if data <= -20 then x = "GranBigNoob" elseif data <= -10 then x = "Big Noob" elseif data <= -1 then x = "Noob" elseif data == 0 then x = "Citizen" elseif data >= 1 then x = "Avowed" elseif data >= 10 and data < 20 then x = "Respected" elseif data >= 20 and data < 30 then x = "Sagaz" elseif data >= 30 and data < 40 then x = "Domination" elseif data >= 40 and data < 20 then x = "Bloodbath" elseif data >= 50 then x = "Legendary" end if isPlayer(thing.uid) then doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." ja Matou: ["..getDeathsAndKills(thing.uid, "kill").."] Players. \n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." ja Morreu: ["..getDeathsAndKills(thing.uid, "death").."] Vezes.\nReputação: "..data.." ("..x..") " ) end return true end Discord: vankk #7765 Precisando de ajuda? Entre em contato comigo via Discord. Muitos vêm seus muitos dias de glória, mas poucos vêm seus muitos dias de luta.
Postado Abril 26, 2016 9 anos Autor Em 20/04/2016 at 06:22, vankk disse: function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d 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 function onLook(cid, thing, position, lookDistance) if data <= -20 then x = "GranBigNoob" elseif data <= -10 then x = "Big Noob" elseif data <= -1 then x = "Noob" elseif data == 0 then x = "Citizen" elseif data >= 1 then x = "Avowed" elseif data >= 10 and data < 20 then x = "Respected" elseif data >= 20 and data < 30 then x = "Sagaz" elseif data >= 30 and data < 40 then x = "Domination" elseif data >= 40 and data < 20 then x = "Bloodbath" elseif data >= 50 then x = "Legendary" end if isPlayer(thing.uid) then doPlayerSetSpecialDescription(thing.uid, "\n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." ja Matou: ["..getDeathsAndKills(thing.uid, "kill").."] Players. \n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." ja Morreu: ["..getDeathsAndKills(thing.uid, "death").."] Vezes.\nReputação: "..data.." ("..x..") " ) end return true end Continuou mesma coisa... 16:39 You see Mega Looter (Level 1202). She is a lord paladin. She is Member of the Et's Bolados (Endemonhado). Ela ja Matou: [182] Players. Ela ja Morreu: [88] Vezes. Reputação: 0 (Citizen) Aparecendo 0 na reputação, mas a reputação deste player é 56 na tabela...
Postado Abril 28, 2016 9 anos local function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if query:getID() ~= -1 then repeat d = d + 1 until not query:next() query:free() end return d end end local function getPoints(cid) local Info = db.getResult("SELECT `rep` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. ";") local s = Info:getDataInt("s") Info:free() return s end if s <= -20 then x = "GranBigNoob" elseif s <= -10 then x = "Big Noob" elseif s <= -1 then x = "Noob" elseif s == 0 then x = "Citizen" elseif s >= 1 then x = "Avowed" elseif s >= 10 and s < 20 then x = "Respected" elseif s >= 20 and s < 30 then x = "Sagaz" elseif s >= 30 and s < 40 then x = "Domination" elseif s >= 40 and s < 20 then x = "Bloodbath" elseif s >= 50 then x = "Legendary" end if isPlayer(thing.uid) then doPlayerSetSpecialDescription(thing.uid, "\n ".. (getPlayerSex(thing.uid) == 0 and "Ela" or "Ele") .." ja Matou: [".. getDeathsAndKills(thing.uid, "kill") .."] Players.\n ".. (getPlayerSex(thing.uid) == 0 and "Ela" or "Ele") .." ja Morreu: [".. getDeathsAndKills(thing.uid, "death") .."] Vezes.\n Reputação: ".. getPoints .." (".. x ..")." ) end end function onLook(cid, thing, position, lookDistance) return getPoints(cid) end Editado Abril 28, 2016 9 anos por anderkrox (veja o histórico de edições) Eternera Tibia Server - RPG
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.