• 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!

AutoPush Delay

alvaro007

New Member
Joined
Jun 15, 2012
Messages
35
Reaction score
2
Hi Community, someone know how disabled the auto push player, i mean, only disable if you push yourself then you cant but obiusly you can continue push other player. Some idea which i edit in my source game.cpp?¿
 
Solution
TFS 0.3.7
Lua:
local yourSelfPush = false

function onPush(cid, target)
if isPlayer(cid) and isMonster(target) then
return true
end
if yourSelfPush == false then
if cid == target then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, 'You can\'t push yourself.')
return false
end end
return true
end

Creaturescripts.xml
XML:
<event type="push" name="YourSelfNoPush" event="script" value="nopush.lua"/>
From what I can understand...

>> data/events/events.xml
XML:
<event class="Player" method="onMoveCreature" enabled="1" />


>> data/events/scripts/player.lua
Lua:
function Player:onMoveCreature(creature, fromPosition, toPosition)
    if creature:getId() == self:getId() then -- If you are trying to push yourself
        self:sendCancelMessage('You can\'t push yourself.')
        return false
    end
    return true
end

By the way, I'm assuming you are using TFS 1.X
 
TFS 0.3.7
Lua:
local yourSelfPush = false

function onPush(cid, target)
if isPlayer(cid) and isMonster(target) then
return true
end
if yourSelfPush == false then
if cid == target then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, 'You can\'t push yourself.')
return false
end end
return true
end

Creaturescripts.xml
XML:
<event type="push" name="YourSelfNoPush" event="script" value="nopush.lua"/>
 
Solution
Back
Top