Humm..
- Forums
- OTServ
- Recursos
- Scripting
- Actions e Talkactions
- Player Check System
CO
talkaction
Player Check System
By comedinhasss, 10 de jan. de 2014 in Actions e Talkactions
[1.0]
script
5
1.6k
14 de janeiro de 2014 às 03:57
info
Group: Campones
Joined: 29/12/13
Posts: 7
Reputation: 0

17 de janeiro de 2014 às 17:58
O script está 100% sem erros e bom funcionamento? Agradeço
info
Group: Herói
Joined: 08/08/07
Posts: 520
Reputation: +235
Gender: Masculino
Tibia Character: Sir Morths

20 de janeiro de 2014 às 05:53
Bom se esta aqui deve estar sem erros né... Já pensou em testar?O script está 100% sem erros e bom funcionamento? Agradeço
info
Group: Lenda
Joined: 03/10/06
Posts: 2.6k
Reputation: +309
Gender: Masculino
Tibia Character: Knight Orion

25 de janeiro de 2014 às 03:17
Nessa parte, Bruno:
for i=1, sep do tsep = tsep.."-" endTroque por
tsep = tsep .. string.rep("-", sep)Menos gambiarra e mais organização
Aliás, nessa mesma função, tem uma porrada de concatenações. Acho que fica mais bonitinho e organizado se você usar variáveis e um string.format




info
Group: Herói
Joined: 08/08/07
Posts: 520
Reputation: +235
Gender: Masculino
Tibia Character: Sir Morths
Versão: 4.0
Distro: 1.0+
Descrição: Existem muitos scripts que ajudam o administrador do servidor a cuidar dele, um deles é saber coisas sobre quem está jogando e se está sendo honesta. Eu peguei alguns scripts e estou juntando em um para diminuir o tamanho e ter uma fácil verificação.
TAG:
Script:
Talkactions/scripts/playercheck.lua
function getItemsInContainer(cont, sep) local text = "" local tsep = "" local count = "" for i=1, sep do tsep = tsep.."-" end tsep = tsep..">" for i=0, getContainerSize(cont.uid)-1 do local item = getContainerItem(cont.uid, i) if isContainer(item.uid) == FALSE then if item.type > 1 then count = " ("..item.type.."x)" end text = text.."\n"..tsep..getItemName(item.itemid)..""..count.." ("..item.itemid..")" else if getContainerSize(item.uid) > 0 then text = text.."\n"..tsep..getItemName(item.itemid).." ("..item.itemid..")" text = text..getItemsInContainer(item, sep+2).."" else text = text.."\n"..tsep..getItemName(item.itemid).." ("..item.itemid..")" end end end return text end function onSay(cid, words, param) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.") return false end local slotName = {"Cabeça", "Amuleto", "Backpack", "Armor", "Mao Direita", "Mao Esquerda", "Legs", "Pés", "Ring", "Ammo Slot"} local t = param:split(', ') if(t[1] == 'check') then if getPlayerGroupId(cid) >= 2 then local p = Player(t[2]) if p then local text = p:getName().."'s Equipment: " for i=1, 10 do text = text.."\n\n" local item = getPlayerSlotItem(p:getName(), i) if item.itemid > 0 then count = '' if item.type > 1 then count = " ("..item.type.."x)" end if isContainer(item.uid) == TRUE then text = text..slotName[i]..": "..getItemName(item.itemid)..""..count.." ("..item.itemid..") "..getItemsInContainer(item, 1) else text = text..slotName[i]..": "..getItemName(item.itemid)..""..count.." ("..item.itemid..")" end else text = text..slotName[i]..": Empty" end end doShowTextDialog(cid, 6579, text) else doPlayerSendCancel(cid, "This player is not online or not exist.") end end elseif(t[1] == 'delete') then if getPlayerGroupId(cid) == 3 then local p = Player(t[2]) if p then count = t[4] if(not t[4]) then count = 1 end if getPlayerItemCount(p:getName(), t[3]) > 0 then if doPlayerRemoveItem(p:getId(), t[3], count) then doPlayerSendCancel(cid, "Deleted Item.") else doPlayerSendCancel(cid, "This player does not have this amount of item.") end else doPlayerSendCancel(cid, "This player does not have the item.") end else doPlayerSendCancel(cid, "This player is not online or not exist.") end end else if getPlayerGroupId(cid) == 3 then id = getItemIdByName(t[1]) if not id then doPlayerSendCancel(cid, "The "..t[1].." not exist. ") return false end local result = db.getResult("SELECT name FROM players WHERE id IN (SELECT player_id FROM player_items WHERE itemtype = ".. id ..");") local msg = "Search results by item ".. getItemName(id) .." in your database:\n\n" if result:getID() ~= -1 then while true do local name = result:getDataString("name") msg = msg .. name .."\n" if not result:next() then break end end else msg = msg .. "The item was not found in any player." end doShowTextDialog(cid, id, msg) end end return true endExplicação:
Quando o god digita:
/p check, (PNAME) - Ele verifica os items que o player tem.
/p del, (ID), (PNAME), (COUNT) - Ele deleta o item de determinado player (Se não colocar o count ele irá remover somente 1).
/p (ID) - Ele verifica quantos players tem tal item.
Créditos:
Oneshot
CaioODemais
Comedinha (Bruno Carvalho)
Edited Janeiro 10 by BrunoCarvalho