leandrozera 4 Postado Junho 6, 2015 Share Postado Junho 6, 2015 olá galerinha do Xtibia gostaria de um comando que god banisse o player do trade e do help, deixando ele sem acesso esses 2 channels alguém poderia ajudar ficarei muito agradecido! Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/ Compartilhar em outros sites More sharing options...
SkyLigh 453 Postado Junho 6, 2015 Share Postado Junho 6, 2015 Que eu saiba não existe código pra isso, mais existe código pra deixar o player mudo também seria útil não acha? Se quiser um script com a função: http://www.xtibia.com/forum/topic/100819-aplicar-muted-em-um-jogador/ Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654609 Compartilhar em outros sites More sharing options...
leandrozera 4 Postado Junho 6, 2015 Autor Share Postado Junho 6, 2015 (editado) Que eu saiba não existe código pra isso, mais existe código pra deixar o player mudo também seria útil não acha? Se quiser um script com a função: http://www.xtibia.com/forum/topic/100819-aplicar-muted-em-um-jogador/ acho que tem como sim amigo pq vi esse sistema em um ot :s Que eu saiba não existe código pra isso, mais existe código pra deixar o player mudo também seria útil não acha? Se quiser um script com a função: http://www.xtibia.com/forum/topic/100819-aplicar-muted-em-um-jogador/ ah uma duvida seria mutar o player apenas no trade e no help isso? se for ajuda tb Editado Junho 6, 2015 por leandrozera Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654611 Compartilhar em outros sites More sharing options...
SkyLigh 453 Postado Junho 6, 2015 Share Postado Junho 6, 2015 (editado) Vi um post do vodkart tente isso vai nas sources e procure por player.cpp bool Player::isMuted(uint16_t channelId, SpeakClasses type, uint32_t& time){time = 0;if(hasFlag(PlayerFlag_CannotBeMuted))return false;int32_t muteTicks = 0;for(ConditionList::iterator it = conditions.begin(); it != conditions.end(); ++it){if((*it)->getType() == CONDITION_MUTED && (*it)->getSubId() == 0 && (*it)->getTicks() > muteTicks)muteTicks = (*it)->getTicks();}time = (uint32_t)muteTicks / 1000;return time > 0 && type != SPEAK_PRIVATE_PN && (type != SPEAK_CHANNEL_Y || (channelId != CHANNEL_GUILD && !g_chat.isPrivateChannel(channelId)));}e troque porbool Player::isMuted(uint16_t channelId, SpeakClasses type, uint32_t& time){time = 0;if(hasFlag(PlayerFlag_CannotBeMuted))return false;int32_t muteTicks = 0;for(ConditionList::iterator it = conditions.begin(); it != conditions.end(); ++it){if((*it)->getType() == CONDITION_MUTED && (*it)->getSubId() == 0 && (*it)->getTicks() > muteTicks)muteTicks = (*it)->getTicks();}time = (uint32_t)muteTicks / 1000;return time > 0 && type != SPEAK_PRIVATE_PN && (type != SPEAK_CHANNEL_Y || (channelId != CHANNEL_GUILD && channelId != CHANNEL_DEFAULT && !g_chat.isPrivateChannel(channelId)));}obs: não tenho certeza se vai funcionar caso não funcione, desta maneira tenho ctz que vai: bool Player::isMuted(uint16_t channelId, SpeakClasses type, uint32_t& time){time = 0;if(hasFlag(PlayerFlag_CannotBeMuted))return false;int32_t muteTicks = 0;for(ConditionList::iterator it = conditions.begin(); it != conditions.end(); ++it){if((*it)->getType() == CONDITION_MUTED && (*it)->getSubId() == 0 && (*it)->getTicks() > muteTicks)muteTicks = (*it)->getTicks();}time = (uint32_t)muteTicks / 1000;return time > 0 && type != SPEAK_PRIVATE_PN && (type != SPEAK_CHANNEL_Y || (channelId != CHANNEL_DEFAULT && !g_chat.isPrivateChannel(channelId)));} Editado Junho 6, 2015 por Kissy Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654613 Compartilhar em outros sites More sharing options...
Furabio 258 Postado Junho 6, 2015 Share Postado Junho 6, 2015 Tópico movido para à área correta. Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654614 Compartilhar em outros sites More sharing options...
leandrozera 4 Postado Junho 6, 2015 Autor Share Postado Junho 6, 2015 Vi um post do vodkart tente isso vai nas sources e procure por player.cpp bool Player::isMuted(uint16_t channelId, SpeakClasses type, uint32_t& time){time = 0;if(hasFlag(PlayerFlag_CannotBeMuted))return false;int32_t muteTicks = 0;for(ConditionList::iterator it = conditions.begin(); it != conditions.end(); ++it){if((*it)->getType() == CONDITION_MUTED && (*it)->getSubId() == 0 && (*it)->getTicks() > muteTicks)muteTicks = (*it)->getTicks();}time = (uint32_t)muteTicks / 1000;return time > 0 && type != SPEAK_PRIVATE_PN && (type != SPEAK_CHANNEL_Y || (channelId != CHANNEL_GUILD && !g_chat.isPrivateChannel(channelId)));}e troque por bool Player::isMuted(uint16_t channelId, SpeakClasses type, uint32_t& time){time = 0;if(hasFlag(PlayerFlag_CannotBeMuted))return false;int32_t muteTicks = 0;for(ConditionList::iterator it = conditions.begin(); it != conditions.end(); ++it){if((*it)->getType() == CONDITION_MUTED && (*it)->getSubId() == 0 && (*it)->getTicks() > muteTicks)muteTicks = (*it)->getTicks();}time = (uint32_t)muteTicks / 1000;return time > 0 && type != SPEAK_PRIVATE_PN && (type != SPEAK_CHANNEL_Y || (channelId != CHANNEL_GUILD && channelId != CHANNEL_DEFAULT && !g_chat.isPrivateChannel(channelId)));}obs: não tenho certeza se vai funcionar caso não funcione, desta maneira tenho ctz que vai: bool Player::isMuted(uint16_t channelId, SpeakClasses type, uint32_t& time){time = 0;if(hasFlag(PlayerFlag_CannotBeMuted))return false;int32_t muteTicks = 0;for(ConditionList::iterator it = conditions.begin(); it != conditions.end(); ++it){if((*it)->getType() == CONDITION_MUTED && (*it)->getSubId() == 0 && (*it)->getTicks() > muteTicks)muteTicks = (*it)->getTicks();}time = (uint32_t)muteTicks / 1000;return time > 0 && type != SPEAK_PRIVATE_PN && (type != SPEAK_CHANNEL_Y || (channelId != CHANNEL_DEFAULT && !g_chat.isPrivateChannel(channelId)));} ok mais teria como criar script em talk para adm poder da mute no player au eu adiciono essas função na source Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654619 Compartilhar em outros sites More sharing options...
RodriigoRobson 111 Postado Junho 6, 2015 Share Postado Junho 6, 2015 (editado) Nao Testei <event type="joinchannel" name="BanChannel" event="script" value="Ban.lua"/> local storageBan = 102030function onJoinChannel(cid, channelId, users)if (channelId == CHANNEL_HELP) and getPlayerStorageValue(cid, storageBan) >= 1 thendoPlayerSendTextMessage(cid, 19, "Voce Foi Banido do Canal!")return falseendreturn trueend - Registra no Login.lua: registerCreatureEvent(cid, "BanChannel") - Testa se funciona , adiciona uma storage com o ADM a um Player Test assim = /storage Nome do Jogador,102030 - e Depois tenta abrir o Canal Help Editado Junho 6, 2015 por Nextbr Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654620 Compartilhar em outros sites More sharing options...
SkyLigh 453 Postado Junho 6, 2015 Share Postado Junho 6, 2015 Tente function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, 21, "explaining the talkaction") return true end local t = string.explode(param, ",") player = getPlayerByName(t[1]) local condition = createConditionObject(CONDITION_MUTED) if(not t[2] or t[2] == '') then doPlayerSendTextMessage(cid, 21, "explaining the talkaction") end if t[2] then time = tonumber(t[2]*1000) -- 10*1000 is 10 seconds. if(isPlayer(player) == TRUE and getPlayerGroupId(cid) > getPlayerGroupId(player) and getPlayerFlagValue(player, PLAYERFLAG_CANNOTBEMUTED) == false) then setConditionParam(condition, CONDITION_PARAM_SUBID, 4) doPlayerSendTextMessage(player, MESSAGE_STATUS_WARNING, "You have been muted by " .. getPlayerName(cid) .. " for " .. t[2] .. " seconds.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(player) .. " has been muted for " .. t[2] .. " seconds.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " is not currently online or cannot be muted.") end end return true end Na linha setConditionParam(condition, CONDITION_PARAM_SUBID, 4)e onde esta 4 ponha o id do channel Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654624 Compartilhar em outros sites More sharing options...
leandrozera 4 Postado Junho 6, 2015 Autor Share Postado Junho 6, 2015 Tente function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, 21, "explaining the talkaction") return true end local t = string.explode(param, ",") player = getPlayerByName(t[1]) local condition = createConditionObject(CONDITION_MUTED) if(not t[2] or t[2] == '') then doPlayerSendTextMessage(cid, 21, "explaining the talkaction") end if t[2] then time = tonumber(t[2]*1000) -- 10*1000 is 10 seconds. if(isPlayer(player) == TRUE and getPlayerGroupId(cid) > getPlayerGroupId(player) and getPlayerFlagValue(player, PLAYERFLAG_CANNOTBEMUTED) == false) then setConditionParam(condition, CONDITION_PARAM_SUBID, 4) doPlayerSendTextMessage(player, MESSAGE_STATUS_WARNING, "You have been muted by " .. getPlayerName(cid) .. " for " .. t[2] .. " seconds.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getCreatureName(player) .. " has been muted for " .. t[2] .. " seconds.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " is not currently online or cannot be muted.") end end return true end Na linha setConditionParam(condition, CONDITION_PARAM_SUBID, 4)e onde esta 4 ponha o id do channel [5/6/2015 22:53:29] [Error - TalkAction Interface] [5/6/2015 22:53:29] data/talkactions/scripts/mute.lua:onSay [5/6/2015 22:53:29] Description: [5/6/2015 22:53:29] data/talkactions/scripts/mute.lua:8: attempt to call global 'getPlayerByName' (a nil value) [5/6/2015 22:53:29] stack traceback: [5/6/2015 22:53:29] data/talkactions/scripts/mute.lua:8: in function <data/talkactions/scripts/mute.lua:1> função getPlayerByName não existe Nao Testei <event type="joinchannel" name="BanChannel" event="script" value="Ban.lua"/> local storageBan = 102030 function onJoinChannel(cid, channelId, users) if (channelId == CHANNEL_HELP) and getPlayerStorageValue(cid, storageBan) >= 1 then doPlayerSendTextMessage(cid, 19, "Voce Foi Banido do Canal!") return false end return true end - Registra no Login.lua: registerCreatureEvent(cid, "BanChannel") - Testa se funciona , adiciona uma storage com o ADM a um Player Test assim = /storage Nome do Jogador,102030 - e Depois tenta abrir o Canal Help [5/6/2015 22:57:5] [Error - CreatureEvent::configureEvent] No valid type for creature event: joinchannel. [5/6/2015 22:57:5] [Warning - BaseEvents::loadFromXml] Cannot configure an event Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654628 Compartilhar em outros sites More sharing options...
SkyLigh 453 Postado Junho 6, 2015 Share Postado Junho 6, 2015 Agora vai eu acho function onSay(cid, words, param) local CHANNEL_HELP = 7 local player = Player(cid) local storage = 456112 if words == "/mute" then local mute = param:split(",") if mute[1] == nil or mute[1] == " " then player:sendCancelMessage("Invalid player specified.") return false end if mute[2] == nil or mute[2] == " " then player:sendCancelMessage("Invalid time specified.") return false end local target = Player(mute[1]) local time = tonumber(mute[2]) local condition = Condition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT) condition:setParameter(CONDITION_PARAM_SUBID, CHANNEL_HELP) condition:setParameter(CONDITION_PARAM_TICKS, time*60*1000) if player:getAccountType() < ACCOUNT_TYPE_TUTOR then return false end if target == nil then player:sendCancelMessage("A player with that name is not online.") return false end if target:getAccountType() >= ACCOUNT_TYPE_TUTOR then player:sendCancelMessage("Only player can be mutated") return false end target:addCondition(condition) sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, target:getName() .. " has been muted by " .. player:getName() .. " for using Help Channel inappropriately.") target:setStorageValue(storage, 1) return false end if words == "/unmute" then local remove = Player(param) if player:getAccountType() < ACCOUNT_TYPE_TUTOR then return false end if remove == nil then player:sendCancelMessage("A player with that name is not online.") return false end if remove:getAccountType() >= ACCOUNT_TYPE_TUTOR then return false end if remove:getStorageValue(storage) == 1 then remove:removeCondition(CONDITION_CHANNELMUTEDTICKS, CONDITIONID_DEFAULT, CHANNEL_HELP) sendChannelMessage(CHANNEL_HELP, TALKTYPE_CHANNEL_R1, remove:getName() .. " has been unmuted by " .. player:getName() .. ".") remove:setStorageValue(storage, -1) else player:sendCancelMessage("A player " .. remove:getName() .. "is not mutated") end end return false end Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654629 Compartilhar em outros sites More sharing options...
leandrozera 4 Postado Junho 6, 2015 Autor Share Postado Junho 6, 2015 [5/6/2015 23:2:30] data/talkactions/scripts/mute.lua:11: attempt to index local 'player' (a boolean value) [5/6/2015 23:2:30] stack traceback: [5/6/2015 23:2:30] data/talkactions/scripts/mute.lua:11: in function <data/talkactions/scripts/mute.lua:1> minha source e otx 8.60 parece que tem umas funções ai do tfs novo Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654630 Compartilhar em outros sites More sharing options...
SkyLigh 453 Postado Junho 6, 2015 Share Postado Junho 6, 2015 Por que você não muda o tfs ? Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1654631 Compartilhar em outros sites More sharing options...
Bruno 536 Postado Julho 14, 2015 Share Postado Julho 14, 2015 O tópico foi fechado e movido para lixeira por estar inativo a mais de 10 dias. Caso seja preciso reabrir o mesmo, favor entrar em contato com a equipe. Link para o comentário https://xtibia.com/forum/topic/234518-help-comando-para-banir-player-no-trade/#findComment-1660174 Compartilhar em outros sites More sharing options...
Posts Recomendados