• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OnPush [ Help Please ]

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
After seeing this thread I thought, in every monster fit 8 people, but if my enemy is training afk, I will push him out.

21kxekm.jpg

What I must do to 'If player try to push player in DUMMY TILE' then he will receive message 'Not possible'.

Examples:
---

I made it:

XML:
<event type="push" name="playerPush" event="script" value="push.lua"/>
Lua:
local fromPosition = {x="1000", y="1000", z="7"}
local toPosition = {x="2000", y="2000", z="9"}
function onPush(cid, target)
if (target == isPlayer(cid)) and (isInRange(cid, fromPosition, toPosition) == true) then
   doPlayerSendCancel(cid, "Sorry, not possible.")
end
end

Evan made it
Here's the script if you wanna do the tile clicking:
Lua:
function onStepIn(cid, item, fromPosition, toPosition)
	if isPlayer(cid) then
		doCreatureSetNoMove(cid, cannotMove)
	end
	return true
end
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(cid) and getCreatureNoMove(cid) == true then
		doCreatureSetNoMove(cid, false)
	end
	return true
end

Evil Mark made it:
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if isPlayer(cid) then
		doCreatureSetNoMove(cid, true)
		doSendAnimatedText(toPosition, "Training!", math.random(0, 255))
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "In order to leave this booth you have to dance.")
		doCreatureSetLookDirection(cid, 0)
		while (getCreatureLookDirection(cid) ~= 0) then
			doCreatureSetNoMove(cid, false)
		end
	else
		doTeleportThing(cid, fromPosition, false)
	end
	return true
end

Aziz made it:
Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if actor ~= cid then
		doTeleportThing(cid, lastPosition, true)
	end
	return true
end

Ratser made this:
antipush.lua:
Lua:
local targetlist, ret = {"Target Dummy"}, true

function onPush(cid, target, ground, position)
	if(isInArray(targetlist, getCreatureTarget(target):lower())) then
		ret = RETURNVALUE_NOTPOSSIBLE
	end
	
	return ret
end
creaturescripts.xml:
XML:
	<event type="push" name="AntiPush" event="script" value="antipush.lua"/>

Does someone knows how to make it automatically?
 
Last edited:
If player create character name called TARGET DUMMY. Will him affect?
Lua:
function onPush(cid, target, ground, position)
	local targetlist, ret = {"Target Dummy"}, true
	if(isCreature(target) and isMonster(getCreatureTarget(target)) and isInArray(targetlist, getCreatureTarget(target):lower())) then
		ret = RETURNVALUE_NOTPOSSIBLE
	end
 
	return ret
end

If A tries to push B and B is attacking a MONSTER called "Target Dummy" then it won't be pushed. If he's attacking a PLAYER called "Target Dummy" then it will.
 
Lua:
local targetList = {"Target Dummy"}

function onPush(cid, target)
	if(isPlayer(cid) and isMonster(getCreatureTarget(target)) and isInArray(targetList, getCreatureTarget(target):lower())) then
		return RETURNVALUE_NOTPOSSIBLE
	end

	return true
end
or
Lua:
local targetList = {"Target Dummy"}

function onPush(cid, target)
	if(isPlayer(cid) and isMonster(getCreatureTarget(target)) and isInArray(targetList, getCreatureTarget(target):lower())) then
		return false
	end

	return true
end
 
Lua:
local targetList = {"Target Dummy"}
 
function onPush(cid, target)
	if(isPlayer(target) and getCreatureTarget(target) and isInArray(targetList, getCreatureName(getCreatureTarget(target)):lower())) then
		return false
	end
 
	return true
end

RETURNVALUE_NOTPOSSIBLE is equal to 1
 
Back
Top