Postado Abril 7, 2016 9 anos Obs 1: Sou ruim em scripts, criei com base em outros, por isso falhei. Bom, esse script é de look, primeiro ele mostra quantos você matou e quantos você morreu, e a segunda parte é a que mostra sua reputação de acordo com a tabela { players, rep} da minha database, porem não está funcionado, pode parecer ridiculo a forma como montei, mas foi a unica que consegui, alguem me da um help? 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 if isPlayer(thing.uid) then local query, s = db.getResult("SELECT `rep` FROM `players` WHERE `id` = " ..getPlayerGUID(cid)), 0 if s <= -20 then x = {"GranBigNoob"} if s <= -10 then x = {"Big Noob"} if s <= -1 then x = {"Noob"} if s == 0 then x = {"Citizen"} if s >= 1 then x = {"Avowed"} if s >= 10 then if s < 20 then x = {"Respected"} if s >= 20 then if s < 30 then x = {"Sagaz"} if s >= 30 then if s < 40 then x = {"Domination"} if s >= 40 then if s < 20 then x = {"Bloodbath"} if s >= 50 then x = {"Legendary"} 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" ) end end end end end end end end end end end end end end end return true end
Postado Abril 7, 2016 9 anos Cara, eu to recém aprendendo lua também, estou cursando o 5 semestre PHP, então se tiver algo errado, perdão. Primeira coisa é os IFs que tu montou... Tu tem que botar ou um END depois do IF, ficando assim: if s <= -20 then x = {"GranBigNoob"} end if s <= -10 then x = {"Big Noob"} end if s ..... Ou ELSEIF, ficando assim: if s <= -20 then x = {"GranBigNoob"} elseif s <= -10 then x = {"Big Noob"} elseif s ..... Nessa linha: 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" ) Em: getPlayerSex(thing.uid) == 0 and "Ela" or "Ele" Acho que se tu só quer pegar o sexo do player, seria: getPlayerSex(cid) Se tu quer apenas falar qual o sexo do player, seria: ..(sex == 0 and "Ela" or "Ele").. Eu acho que funciona dos dois jeitos, comentei apenas para caso não funcionasse. Voltando nos IFs, caso algum seja true, você da um valor em string para a variável "x", mas não usa ela em lugar nenhum. Mesma coisa com o "s", você declara a variável com o valor "0" e não tem nenhuma outra linha modificando o valor dessa variável, o valor dela SEMPRE será "0". Ah, e não se esqueça de tirar os ENDs correspondentes nas últimas linhas. Se ainda estiver com algum problema, tenta explicar melhor o que você quer, não consegui entender direito. Vou tentar ajudar como eu puder. Como eu disse, estou recém aprendendo lua. Editado Abril 8, 2016 9 anos por Talesigorvr (veja o histórico de edições) Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
Postado Abril 8, 2016 9 anos e como ficaria o script completo e funcionando curtir gostaria de colocar no meu ot
Postado Abril 8, 2016 9 anos Tente fazer as alterações que eu citei, mas não sei se vai funcionar... Editado Abril 8, 2016 9 anos por Talesigorvr (veja o histórico de edições) Não dou suporte via PM, crie um tópico caso tenha dúvidas. Isso previne que outras pessoas com a mesma dúvida criem tópicos desnecessários.
Postado Abril 8, 2016 9 anos Autor 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 local query,s = db.getResult("SELECT `rep` FROM ".."`players`".." WHERE `id` = "..getPlayerGUID(cid)),0 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" 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. \nReputacao: "..s.."("..x..") " ) end end return true end Refiz o script, porem na hora do look aparece assim: 15:29 You see Abomination Demon (Level 857). He is a elder druid. Ele ja Matou: [1] Players. Ele ja Morreu: [0] Vezes. Mas nao aparece a parte da Reputação: no finalzinho ali da descrição... Eu estou tentando fazer aparecer assim: 15:29 You see Abomination Demon (Level 857). He is a elder druid. Ele ja Matou: [1] Players. Ele ja Morreu: [0] Vezes. Reputacao: 10 (Respected). Editado Abril 8, 2016 9 anos por Baned (veja o histórico de edições)
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.