Pluzetti 19 Postado Outubro 30, 2013 Share Postado Outubro 30, 2013 Galera estou com esse script, mas eu ja tentei mudar para ele remover um item mas nao consigo, poderiam me ajudar? function onSay(cid, words, param, channel) local p = string.explode(param, ',') local item_id = 2195 if(param == "") then doPlayerSendCancel(cid, "Command requires param.") doPlayerRemoveItem(cid, item_id, 1) return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") end end Item ID= 2145 Link para o comentário https://xtibia.com/forum/topic/223297-name/ Compartilhar em outros sites More sharing options...
0 Omega 377 Postado Outubro 30, 2013 Share Postado Outubro 30, 2013 Essa seção não deve ser usada para pedidos ou dúvidas, temos uma seção específica para isso. Por favor, preste mais atenção da próxima vez.Movido para Pedidos e Dúvidas - Scripting. Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577437 Compartilhar em outros sites More sharing options...
0 Lumus 254 Postado Outubro 31, 2013 Share Postado Outubro 31, 2013 Tentaivos assim, não estou em casa por isso não testei: Talkactions: function onSay(cid, words, param, channel) local p = string.explode(param, ',') if(param == "") then doPlayerSendCancel(cid, "Command requires param.") return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") and doPlayerSetStorageValue(cid, 14581, 1) end end Creaturescripts/scripts crie um arquivo e renomeie para removeitem.lua function onLogin(cid) local item_id = 2195 if getPlayerStorageValue(cid, 14581) == 1 then doPlayerRemoveItem(cid, item_id, 1) else return false end return true end Tag no xml: <event type="login" name="Removeitem" event="script" value="removeitem.lua"/> Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577516 Compartilhar em outros sites More sharing options...
0 Killua 389 Postado Outubro 31, 2013 Share Postado Outubro 31, 2013 Vc deveria explicar melhor oque quer. Se for so remover um item quando usa o comando, acho que é só por um doPlayerRemoveItem(cid, xxx, 1) antes do ultimo end. @Fawz pq fazer isso por creaturescripts? Oo Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577525 Compartilhar em outros sites More sharing options...
0 Pluzetti 19 Postado Outubro 31, 2013 Autor Share Postado Outubro 31, 2013 Eu queria assim... eu falo /name Kevin, [ADM] Zerone...se eu tiver o item 2145 eu mudo o nome se eu não tiver da a mensagem que eu não tenho o item necessario, seria 5 diamonds (2145). Obrigado. Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577593 Compartilhar em outros sites More sharing options...
0 Killua 389 Postado Outubro 31, 2013 Share Postado Outubro 31, 2013 Testa function onSay(cid, words, param, channel) if not getPlayerItem(cid, 2145) >= 5 then doPlayerSendCancel(cid, "Voce precisa de pelo menos 5 diamonds.") return false end local p = string.explode(param, ',') local item_id = 2195 if(param == "") then doPlayerSendCancel(cid, "Command requires param.") doPlayerRemoveItem(cid, item_id, 1) return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") doPlayerRemoveItem(cid, 2145, 5) end end Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577615 Compartilhar em outros sites More sharing options...
0 Pluzetti 19 Postado Outubro 31, 2013 Autor Share Postado Outubro 31, 2013 Testa function onSay(cid, words, param, channel) if not getPlayerItem(cid, 2145) >= 5 then doPlayerSendCancel(cid, "Voce precisa de pelo menos 5 diamonds.") return false end local p = string.explode(param, ',') local item_id = 2195 if(param == "") then doPlayerSendCancel(cid, "Command requires param.") doPlayerRemoveItem(cid, item_id, 1) return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") doPlayerRemoveItem(cid, 2145, 5) end end Nao funciono da erro no distro... data/talkactions/scripts/name.lua:22: 'end' expected (to close 'if' at line 13) near 'doPlayerRemoveItem' Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577650 Compartilhar em outros sites More sharing options...
0 Killua 389 Postado Outubro 31, 2013 Share Postado Outubro 31, 2013 Foi mal eu tinha feito pelo celular. function onSay(cid, words, param, channel) if not getPlayerItem(cid, 2145) >= 5 then doPlayerSendCancel(cid, "Voce precisa de pelo menos 5 diamonds.") return false end local p = string.explode(param, ',') local item_id = 2195 if(param == "") then doPlayerSendCancel(cid, "Command requires param.") doPlayerRemoveItem(cid, item_id, 1) return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlyyereenCaancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end doPlayerRemoveItem(cid, 2145, 5) return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") end end Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577663 Compartilhar em outros sites More sharing options...
0 Pluzetti 19 Postado Outubro 31, 2013 Autor Share Postado Outubro 31, 2013 Foi mal eu tinha feito pelo celular. function onSay(cid, words, param, channel) if not getPlayerItem(cid, 2145) >= 5 then doPlayerSendCancel(cid, "Voce precisa de pelo menos 5 diamonds.") return false end local p = string.explode(param, ',') local item_id = 2195 if(param == "") then doPlayerSendCancel(cid, "Command requires param.") doPlayerRemoveItem(cid, item_id, 1) return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlyyereenCaancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end doPlayerRemoveItem(cid, 2145, 5) return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") end end [31/10/2013 15:30:31] [Error - TalkAction Interface] [31/10/2013 15:30:31] data/talkactions/scripts/name.lua:onSay [31/10/2013 15:30:31] Description: [31/10/2013 15:30:31] data/talkactions/scripts/name.lua:3: attempt to call global 'getPlayerItem' (a nil value) [31/10/2013 15:30:31] stack traceback: [31/10/2013 15:30:31] data/talkactions/scripts/name.lua:3: in function <data/talkactions/scripts/name.lua:1> esse erro me passa seu face melhor pra resolver o erro. Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577692 Compartilhar em outros sites More sharing options...
0 Killua 389 Postado Outubro 31, 2013 Share Postado Outubro 31, 2013 no lugar de getPlayerItem bota getPlayerItemCount, erro meu Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577698 Compartilhar em outros sites More sharing options...
0 Pluzetti 19 Postado Outubro 31, 2013 Autor Share Postado Outubro 31, 2013 Ja fiz como vc falo agr da esse erro na distro... [31/10/2013 16:18:48] [Error - TalkAction Interface] [31/10/2013 16:18:48] data/talkactions/scripts/name.lua:onSay [31/10/2013 16:18:48] Description: [31/10/2013 16:18:48] data/talkactions/scripts/name.lua:3: attempt to compare number with boolean [31/10/2013 16:18:48] stack traceback: [31/10/2013 16:18:48] data/talkactions/scripts/name.lua:3: in function <data/talkactions/scripts/name.lua:1> Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577699 Compartilhar em outros sites More sharing options...
0 Lumus 254 Postado Outubro 31, 2013 Share Postado Outubro 31, 2013 (editado) Eu achei que ele queria que assim que o god, adm, tutor ou seja lá quem usasse o comando, seria removido do jogador que foi mudado o nome, não de quem usou... meio sem lógica alguém do nada mudar seu nome... Tenta assim: function onSay(cid, words, param, channel) if not getPlayerItem(cid, 2145) >= 5 then doPlayerSendCancel(cid, "Voce precisa de pelo menos 5 diamonds.") return false end local p = string.explode(param, ',') local item_id = 2195 if(param == "") then doPlayerSendCancel(cid, "Command requires param.") doPlayerRemoveItem(cid, item_id, 1) return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlyyereenCaancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end if doPlayerRemoveItem(cid, 2145, 5) then return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") end end return true end Editado Outubro 31, 2013 por Fawz Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577845 Compartilhar em outros sites More sharing options...
0 zipter98 1102 Postado Novembro 1, 2013 Share Postado Novembro 1, 2013 (editado) Não to em casa, então n testei function onSay(cid, words, param, channel) local p = string.explode(param, ',') local item_id = 2195 local item_count = 1 --Mude aqui a qnt de diamonds q vai remover do player. if getPlayerItemCount(cid, item_id) < 5 then return doPlayerSendCancel(cid, "vc precisa de 5 diamonds.") end if(param == "") then doPlayerSendCancel(cid, "Command requires param.") return true end if(words == "/name") then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlayerSendCancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end doPlayerRemoveItem(cid, item_id, item_count) db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") end end Editado Novembro 1, 2013 por zipter98 Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577856 Compartilhar em outros sites More sharing options...
0 Killua 389 Postado Novembro 1, 2013 Share Postado Novembro 1, 2013 @Fawz realemente eh estranho. E outra coisa só pra nao deixar passa, do jeito q vc fez ele perderia o item toda vez que logasse. Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577860 Compartilhar em outros sites More sharing options...
0 Pluzetti 19 Postado Novembro 1, 2013 Autor Share Postado Novembro 1, 2013 Nenhum funfo...sem erro no distro ele simplesmente fala e nada acontece. Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577884 Compartilhar em outros sites More sharing options...
0 Killua 389 Postado Novembro 1, 2013 Share Postado Novembro 1, 2013 function onSay(cid, words, param, channel) local p = string.explode(param, ',') local item_id = 2195 if(param == "") then doPlayerSendCancel(cid, "Command requires param.") doPlayerRemoveItem(cid, item_id, 1) return true end if(words == "/name") then if getPlayerItemCount(cid, 2145) >= 5 then if(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[1]) .. ";"):getID() == -1) then return doPlyyereenCaancel(cid, "Sorry, but player [" .. p[1] .. "] does not exist.") elseif(isPlayerBanished(p[1], PLAYERBAN_LOCK)) then return doPlayerSendCancel(cid, "Sorry, but " .. p[1] .. " is name locked.") elseif(db.getResult("SELECT `id` FROM `players` WHERE `name` = " .. db.escapeString(p[2]) .. ";"):getID() == 1) then return doPlayerSendCancel(cid, "Sorry, but the name [" .. p[2] .. "] already exists.") end doPlayerRemoveItem(cid, 2145, 5) return db.executeQuery("UPDATE `players` SET `name` = '" .. p[2] .. "' WHERE name = '" .. p[1] .. "';") and doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have changed " .. p[1] .. "'s name to " .. p[2] .. ".") end else doPlayerSendCancel(cid, "Voce precisa de pelo menos 5 diamonds.") return true end end Link para o comentário https://xtibia.com/forum/topic/223297-name/#findComment-1577885 Compartilhar em outros sites More sharing options...
Pergunta
Pluzetti 19
Galera estou com esse script, mas eu ja tentei mudar para ele remover um item mas nao consigo, poderiam me ajudar?
function onSay(cid, words, param, channel)
Link para o comentário
https://xtibia.com/forum/topic/223297-name/Compartilhar em outros sites
Top Posters For This Question
15
7
7
4
Popular Days
Nov 4
14
Nov 1
11
Out 31
9
Out 30
2
Top Posters For This Question
Pluzetti 15 posts
Killua 7 posts
Maenilse 7 posts
zipter98 4 posts
Popular Days
Nov 4 2013
14 posts
Nov 1 2013
11 posts
Out 31 2013
9 posts
Out 30 2013
2 posts
Popular Posts
Pluzetti
Galera estou com esse script, mas eu ja tentei mudar para ele remover um item mas nao consigo, poderiam me ajudar? Item ID= 2145
zipter98
Ele postou o script assim, só editei o que ele pediu ._. Mas se for mesmo necessário, eu retiro o if words. EDIT: Pronto, editei o post lá.
36 respostass a esta questão
Posts Recomendados