Postado Abril 16, 2015 10 anos Cara sempre que não funcionar poste o erro que dá, tu tinha postado falando que não funcionou e não falou o erro que dava, tu acha que eu tenho bola de cristal pra saber o que se passa no seu server ? Segundo, esse erro foi porque tu copiou errado, esqueceu de copiar o ultimo end... function onSay(cid, words, param) local player = Player(cid) local m = string.explode(param, ",") local target = Player(m[1]) local time = tonumber(m[2]) if player:getAccountType() < ACCOUNT_TYPE_TUTOR then return false end if time == nil then player:sendCancelMessage("Invalid param specified.") 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_NORMAL then player:sendCancelMessage("You can only mutate a normal player.") return false end if time == 0 and time >= 360 then player:sendCancelMessage("you can only mute for a maximum of 360 minutes") return false end local condition = Condition(CONDITION_MUTED) condition:setParameter(CONDITION_PARAM_TICKS, time*60*1000) target:doaddCondition(condition) target:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been muted by " .. player:getName() .. " , to "..time.. " minutes.") player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You muted " .. target:getName() .." to "..time.." minutes.") return true end Editado Abril 16, 2015 10 anos por Linus (veja o histórico de edições)
Postado Abril 16, 2015 10 anos Em data/talkactions crie um arquivo com nome Muteplayer.lua e cole isso dentro : local v = {} for k = 1, 100 do table.insert(v, createConditionObject(CONDITION_MUTED)) setConditionParam(v[k], CONDITION_PARAM_TICKS, k*60*1000) end function onSay(cid, words, param) --Mensagem que será enviada ao jogador message = "Você Foi Mutado Por ".. getCreatureName(cid) .."." if (words == "/mute") then local t = string.explode(param, ",") if param == '' then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Invalid param specified.") return true end local player,time,pid = getPlayerByName(t[1]),t[2],getPlayerByNameWildcard(t[1]) if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Jogador com esse nome não existe ou está offline.") return TRUE end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você mutou o jogador "..t[1].." por "..time.." minuto(s).") doAddCondition(player, v[tonumber(time)]) setPlayerStorageValue(player, 90000, os.time()+time*60) doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_RED, message) elseif (words == "/desmute") then if param == '' then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Invalid param specified.") return true end local player = getPlayerByNameWildcard(param) if(not player)then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Jogador Não Encontrado.") return true end if getCreatureCondition(player, CONDITION_MUTED) == false then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Este Jogador Não Esta Mutado.") return true end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Você desmutou o jogador "..param..".") doRemoveCondition(player, CONDITION_MUTED) setPlayerStorageValue(player, 90000, -1) doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_RED, "Você foi Desmutado Por ".. getCreatureName(cid) ..".") end return true end Adicione essa tag em talkactions.xml : <talkaction log="yes" words="/mute;/desmute" access="1" event="script" value="muteplayer.lua"/> Em data/creatureevents crie um arquivo com nome Mute_check e cole isso dentro : local v = {} for k = 1, 100000 do table.insert(v, createConditionObject(CONDITION_MUTED)) setConditionParam(v[k], CONDITION_PARAM_TICKS, k*1000) end function onLogin(cid) if getPlayerStorageValue(cid, 90000) >= os.time() then doAddCondition(cid, v[tonumber(getPlayerStorageValue(cid, 90000) - os.time())]) end return TRUE end Em Creatureevents.xml adicione essa tag: <event type="login" name="MutePlayer" event="script" value="mute_check.lua"/> Comandos: /mute teste,5 (muta por 5 minutos)/desmute teste (desmuta o player)Lembrando que mesmo se o player deslogar, ele continua mutado... Editado Abril 16, 2015 10 anos por brendoonh (veja o histórico de edições)
Postado Abril 16, 2015 10 anos <talkaction log="no" access="1" words="/mute" event="script" value="arquivo.lua"/> function onSay(cid, words, param) local param = string.explode(param, ",") if not tostring(param[1]) or tonumber(param[2]) then return doPlayerSendCancel(cid, "It's wrong, please use: /mute player, time") end if getPlayerByName(param[1]) then doMutePlayer(param[1] , param[2]) else doPlayerSendCancel(cid, "This player doesn't exists") end return true end /mute Caronte,10
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.