Jump to content

(Resolvido)[Pedido] Talkaction !pvp


Go to solution Solved by Kolisium,

Recommended Posts

Ola pessoal, meu pedido é o seguinte, gostaria de uma Talkaction que se o player dizer !pvp off, as magias de area dele nao peguem em ninguem, ou seja ele não pegue pk, mas porem qualquer outro player pode matar o msm, e quando o player disser !pvp on ele volta ao normal dando dano nas magias de area.

 

Utilidade, varias hunts no meu server são boas pra caçar na UE e esse comando vai ajudar muito.

 

Uso TFS 0.3.6.

 

Link to post
Share on other sites
  • Solution

creaturescripts:

function onCombat(cid, target)
    if isPlayer(cid) and isPlayer(target) then
    	if getPlayerStorageValue(cid, 123456) == 1 then return false end
    end
    return true
end

function onTarget(cid,target)
	if isPlayer(cid) and isPlayer(target) then
		if getPlayerStorageValue(cid,123456) == 1 then
			doPlayerSendCancel(cid, "Reative o PVP para atacar um jogador.")
			return false
		end
	end
	return true
end

function onLogin(cid)
	registerCreatureEvent(cid, "PVPTarget")
	registerCreatureEvent(cid, "PVPCombat")
	return true
end

.xml :

<event type="login" name="PVPLogin" event="script" value="script.lua"/>

<event type="target" name="PVPTarget" event="script" value="script.lua"/>

<event type="combat" name="PVPCombat" event="script" value="script.lua"/>

talkactions:

function onSay(cid, words, param, channel)

	if param == "" then
		return doPlayerSendCancel(cid, "Escolha se quer deixar o PVP on ou off.")
	end

	if isInArray({"on","off"}, param) then
		local value = param == "on" and 1 or 0
		local status = param == "on" and "ativou" or "desativou"
		doPlayerSetStorageValue(cid, 123456, value)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você "..status.." o PVP.")
	else
		doPlayerSendCancel(cid, "Escolha se quer deixar o PVP on ou off.")
	end
	return true
end

Tag coloque como quiser.

 

Creditos: Killua

Link to post
Share on other sites
  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Confirmação de Termo