RO

/mute Apenas no help

Por roriscrave, 26 de jul. de 2015 em Scripts

otserv
52
9.8k
SkyLighS
05 de agosto de 2015 às 08:14

Em channels.xml, especifique um número para conditionId, como conditionId = "4" e use a talkaction assim

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)
			doAddCondition(player, condition)
			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
BrunoB
05 de agosto de 2015 às 08:44

Sendo que o jogador e o tempo ja foram informados!

Teste agora:

 

function onSay(cid, words, param)

	local CHANNEL_HELP = 7
	local storage = 456112

	if words == "/mute" then
		local mute = param:split(",")
		local target = getPlayerByName(mute[1])
		local time = tonumber(mute[2])

		if target == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if time == nil then
			doPlayerSendCancel(cid, "Informe o tempo em minutos.")
			return false
		end

		local condition = createConditionObject(CONDITION_MUTED)
		setConditionParam(condition, CONDITION_PARAM_SUBID, CHANNEL_HELP)
		setConditionParam(condition, CONDITION_PARAM_TICKS, time * 60 * 1000)

		doAddCondition(target, condition)
		doPlayerSendTextMessage(target, MESSAGE_INFO_DESCR, "Você foi mutado por " .. time .. " minutos.")
		setPlayerStorageValue(target, storage, 1)
		return false
	elseif words == "/unmute" then
		local remove = getPlayerByName(param)

		if remove == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if getPlayerStorageValue(remove, storage) == 1 then
			doRemoveCondition(remove, CONDITION_MUTED, CONDITIONID_DEFAULT, CHANNEL_HELP)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você desmutou o jogador " .. getCreatureName(remove) .. ".")
			setPlayerStorageValue(target, storage, -1)
		else
			doPlayerSendCancel(cid, "O jogador " .. getCreatureName(remove) .. " nao esta mutado.")
		end
	end
	return false
end

 

Editado Agosto 5 por Bruno Minervino

Luga03L
05 de agosto de 2015 às 09:27

Acabei de testar! quando eu falo

 

"/mute Testando, 10"

 

Aparece isto:

 

"Jogador nao encontrado ou nao esta online."

BrunoB
05 de agosto de 2015 às 09:48

Acabei de testar! quando eu falo

 

"/mute Testando, 10"

 

Aparece isto:

 

"Jogador nao encontrado ou nao esta online."

Teste agora please...

Luga03L
05 de agosto de 2015 às 10:09

Teste agora please...

Agora eu falo

 

"/mute Testando, 10"

 

aparece isto:

 

"Informe o tempo em minutos."

BrunoB
05 de agosto de 2015 às 10:17

Agora eu falo

 

"/mute Testando, 10"

 

aparece isto:

 

"Informe o tempo em minutos."

Tente assim:

"/mute Testando,10"

Sem espaço

Luga03L
05 de agosto de 2015 às 10:21

Tente assim:

"/mute Testando,10"

Sem espaço

tentei sem o espaço e cuntinua mandando a mesma msg!

BrunoB
05 de agosto de 2015 às 10:54

tentei sem o espaço e cuntinua mandando a mesma msg!

Assim vai?

 

function onSay(cid, words, param)

	local CHANNEL_HELP = 7
	local storage = 456112

	if words == "/mute" then
		local mute = string.explode(param, ",")
		local target = getPlayerByName(mute[1])
		local time = tonumber(mute[2])

		if target == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if time == nil then
			doPlayerSendCancel(cid, "Informe o tempo em minutos.")
			return false
		end

		local condition = createConditionObject(CONDITION_MUTED)
		setConditionParam(condition, CONDITION_PARAM_SUBID, CHANNEL_HELP)
		setConditionParam(condition, CONDITION_PARAM_TICKS, time * 60 * 1000)

		doAddCondition(target, condition)
		doPlayerSendTextMessage(target, MESSAGE_INFO_DESCR, "Você foi mutado por " .. time .. " minutos.")
		setPlayerStorageValue(target, storage, 1)
		return false
	elseif words == "/unmute" then
		local remove = getPlayerByName(param)

		if remove == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if getPlayerStorageValue(remove, storage) == 1 then
			doRemoveCondition(remove, CONDITION_MUTED, CONDITIONID_DEFAULT, CHANNEL_HELP)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você desmutou o jogador " .. getCreatureName(remove) .. ".")
			setPlayerStorageValue(target, storage, -1)
		else
			doPlayerSendCancel(cid, "O jogador " .. getCreatureName(remove) .. " nao esta mutado.")
		end
	end
	return false
end

 

Editado Agosto 5 por Bruno Minervino

leandrozeraL
05 de agosto de 2015 às 11:00

Assim vai?

 

 

function onSay(cid, words, param)

	local CHANNEL_HELP = 7
	local storage = 456112

	if words == "/mute" then
		local mute = string.explode(param, ",")
		local target = getPlayerByName(mute[1])
		local time = tonumber(mute[2])

		if target == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if time == nil then
			doPlayerSendCancel(cid, "Informe o tempo em minutos.")
			return false
		end

		local condition = createConditionObject(CONDITION_MUTED)
		setConditionParam(condition, CONDITION_PARAM_SUBID, CHANNEL_HELP)
		setConditionParam(condition, CONDITION_PARAM_TICKS, time * 60 * 1000)

		doAddCondition(target, condition)
		doPlayerSendTextMessage(target, MESSAGE_INFO_DESCR, "Você foi mutado por " .. time .. " minutos.")
		setPlayerStorageValue(target, storage, 1)
		return false
	elseif words == "/unmute" then
		local remove = getPlayerByName(param)

		if remove == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if getPlayerStorageValue(remove, storage) == 1 then
			doRemoveCondition(remove, CONDITION_MUTED, CONDITIONID_DEFAULT, CHANNEL_HELP)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você desmutou o jogador " .. getCreatureName(remove) .. ".")
			setPlayerStorageValue(target, storage, -1)
		else
			doPlayerSendCancel(cid, "O jogador " .. getCreatureName(remove) .. " nao esta mutado.")
		end
	end
	return false
end

 

tb preciso desse script aqui player mutado continua mandando mensagem

Luga03L
05 de agosto de 2015 às 11:01

Agora está dando este erro:

 

[05/08/2015 10:59:19] [Error - TalkAction Interface]
[05/08/2015 10:59:19] data/talkactions/scripts/muteplayer.lua:onSay
[05/08/2015 10:59:19] Description:
[05/08/2015 10:59:19] (luaCreateConditionObject) This function can only be used while loading the script.
[05/08/2015 10:59:19] [Error - TalkAction Interface]
[05/08/2015 10:59:19] data/talkactions/scripts/muteplayer.lua:onSay
[05/08/2015 10:59:19] Description:
[05/08/2015 10:59:19] (luaSetConditionParam) This function can only be used while loading the script.
[05/08/2015 10:59:19] [Error - TalkAction Interface]
[05/08/2015 10:59:19] data/talkactions/scripts/muteplayer.lua:onSay
[05/08/2015 10:59:19] Description:
[05/08/2015 10:59:19] (luaSetConditionParam) This function can only be used while loading the script.
[05/08/2015 10:59:19] [Error - TalkAction Interface]
[05/08/2015 10:59:19] data/talkactions/scripts/muteplayer.lua:onSay
[05/08/2015 10:59:19] Description:
[05/08/2015 10:59:19] (luaDoAddCondition) Condition not found
BrunoB
05 de agosto de 2015 às 11:08

Agora está dando este erro:

Tente assim (estou no serviço e não posso testar):

local CHANNEL_HELP = 7
local storage = 456112

local condition = createConditionObject(CONDITION_MUTED)

function onSay(cid, words, param)
	if words == "/mute" then
		local mute = string.explode(string.lower(param), ",")
		local target = getPlayerByName(mute[1])
		local tempo = tonumber(mute[2])

		if target == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if tempo == nil then
			doPlayerSendCancel(cid, "Informe o tempo em minutos.")
			return false
		end
		setConditionParam(condition, CONDITION_PARAM_SUBID, CHANNEL_HELP)
		setConditionParam(condition, CONDITION_PARAM_TICKS, tempo * 60 * 1000)
		doAddCondition(target, condition)
		doPlayerSendTextMessage(target, MESSAGE_INFO_DESCR, "Você foi mutado por " .. tempo .. " minutos.")
		setPlayerStorageValue(target, storage, 1)
		return false
	elseif words == "/unmute" then
		local remove = getPlayerByName(param)

		if remove == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if getPlayerStorageValue(remove, storage) == 1 then
			doRemoveCondition(remove, CONDITION_MUTED, CONDITIONID_DEFAULT, CHANNEL_HELP)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você desmutou o jogador " .. getCreatureName(remove) .. ".")
			setPlayerStorageValue(target, storage, -1)
		else
			doPlayerSendCancel(cid, "O jogador " .. getCreatureName(remove) .. " nao esta mutado.")
		end
	end
	return false
end

Editado Agosto 5 por Bruno Minervino

Luga03L
05 de agosto de 2015 às 11:16

Não acontece nada! e quando eu dou reload no server aparece isto:

 

[05/08/2015 11:14:55] [Error - TalkAction Interface]
[05/08/2015 11:14:55] data/talkactions/scripts/muteplayer.lua
[05/08/2015 11:14:55] Description:
[05/08/2015 11:14:55] data/talkactions/scripts/muteplayer.lua:6: attempt to perform arithmetic on global 'time' (a nil value)
[05/08/2015 11:14:55] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/muteplayer.lua)
BrunoB
05 de agosto de 2015 às 11:33

Não acontece nada! e quando eu dou reload no server aparece isto:

Segue:

 

local CHANNEL_HELP = 7
local storage = 456112

local condition = createConditionObject(CONDITION_MUTED)

function onSay(cid, words, param)
	if words == "/mute" then
		local mute = string.explode(string.lower(param), ",")
		local target = getPlayerByName(mute[1])
		local tempo = tonumber(mute[2])

		if target == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if tempo == nil then
			doPlayerSendCancel(cid, "Informe o tempo em minutos.")
			return false
		end
		setConditionParam(condition, CONDITION_PARAM_SUBID, CHANNEL_HELP)
		setConditionParam(condition, CONDITION_PARAM_TICKS, tempo * 60 * 1000)
		doAddCondition(target, condition)
		doPlayerSendTextMessage(target, MESSAGE_INFO_DESCR, "Você foi mutado por " .. tempo .. " minutos.")
		setPlayerStorageValue(target, storage, 1)
		return false
	elseif words == "/unmute" then
		local remove = getPlayerByName(param)

		if remove == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if getPlayerStorageValue(remove, storage) == 1 then
			doRemoveCondition(remove, CONDITION_MUTED, CONDITIONID_DEFAULT, CHANNEL_HELP)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você desmutou o jogador " .. getCreatureName(remove) .. ".")
			setPlayerStorageValue(target, storage, -1)
		else
			doPlayerSendCancel(cid, "O jogador " .. getCreatureName(remove) .. " nao esta mutado.")
		end
	end
	return false
end

 

Luga03L
05 de agosto de 2015 às 11:36

este erro quando eu tento mutar o player:

 

[05/08/2015 11:35:20] [Error - TalkAction Interface]
[05/08/2015 11:35:20] data/talkactions/scripts/muteplayer.lua:onSay
[05/08/2015 11:35:20] Description:
[05/08/2015 11:35:20] (luaSetConditionParam) This function can only be used while loading the script.
[05/08/2015 11:35:20] [Error - TalkAction Interface]
[05/08/2015 11:35:20] data/talkactions/scripts/muteplayer.lua:onSay
[05/08/2015 11:35:20] Description:
[05/08/2015 11:35:20] (luaSetConditionParam) This function can only be used while loading the script.
BrunoB
05 de agosto de 2015 às 11:40

este erro quando eu tento mutar o player:

Tenta assim:

 

local CHANNEL_HELP = 7
local storage = 456112
local minutes = 3 -- tempo em minutos para mutar o player

local condition = createConditionObject(CONDITION_MUTED)
setConditionParam(condition, CONDITION_PARAM_SUBID, CHANNEL_HELP)
setConditionParam(condition, CONDITION_PARAM_TICKS, minutes * 60 * 1000)

function onSay(cid, words, param)
	if words == "/mute" then
		local mute = string.explode(string.lower(param), ",")
		local target = getPlayerByName(mute[1])

		if target == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		doAddCondition(target, condition)
		doPlayerSendTextMessage(target, MESSAGE_INFO_DESCR, "Você foi mutado por " .. minutes .. " minutos.")
		setPlayerStorageValue(target, storage, 1)
		return false
	elseif words == "/unmute" then
		local remove = getPlayerByName(param)

		if remove == false then
			doPlayerSendCancel(cid, "Jogador nao encontrado ou nao esta online.")
			return false
		end

		if getPlayerStorageValue(remove, storage) == 1 then
			doRemoveCondition(remove, CONDITION_MUTED, CONDITIONID_DEFAULT, CHANNEL_HELP)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você desmutou o jogador " .. getCreatureName(remove) .. ".")
			setPlayerStorageValue(target, storage, -1)
		else
			doPlayerSendCancel(cid, "O jogador " .. getCreatureName(remove) .. " nao esta mutado.")
		end
	end
	return false
end

 

 

Agora use apenas /mute Player

Att.