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

TFS 1.X+ do not push target

Pedrook

Advanced OT User
Joined
May 24, 2009
Messages
442
Solutions
3
Reaction score
183
Location
Brazil
Hello, good night.

I would like help to adapt this script to tfs 1.2 works the following way, if I'm attacking such a bixo can not push me.

Lua:
local config = {
    targetList = {
        [1] = 'purching bag'
    },
    access = 3 -- Gamemaster
}

function onPush(cid, target)
    if getPlayerAccess(cid) >= config.access then
        return true
    end

    if target == cid or not isPlayer(target) then
        return true
    end

    if (getCreatureTarget(target) > 0 and isInArray(config.targetList, getCreatureName(getCreatureTarget(target)):lower())) then
        doPlayerSendCancel(cid, "You cannot move this player.")
        return false
    end

    return true
end
 
Solution
data/events/scripts/player.lua (replace onMoveCreature)

Lua:
local config = {
    targetList = {"Purching Bag"},
    access = 3
}

function Player:onMoveCreature(creature, fromPosition, toPosition)
    if not creature:isPlayer() then
        return true
    end
    local target = creature:getTarget()
    if target then
        if isInArray(config.targetList, target:getName()) and self:getGroup():getId() < config.access then
            return false
        end
    end
    return true
end

in events.xml set enabled="1" for onMoveCreature
data/events/scripts/player.lua (replace onMoveCreature)

Lua:
local config = {
    targetList = {"Purching Bag"},
    access = 3
}

function Player:onMoveCreature(creature, fromPosition, toPosition)
    if not creature:isPlayer() then
        return true
    end
    local target = creature:getTarget()
    if target then
        if isInArray(config.targetList, target:getName()) and self:getGroup():getId() < config.access then
            return false
        end
    end
    return true
end

in events.xml set enabled="1" for onMoveCreature
 
Solution
data/events/scripts/player.lua (replace onMoveCreature)

Lua:
local config = {
    targetList = {"Purching Bag"},
    access = 3
}

function Player:onMoveCreature(creature, fromPosition, toPosition)
    if not creature:isPlayer() then
        return true
    end
    local target = creature:getTarget()
    if target then
        if isInArray(config.targetList, target:getName()) and self:getGroup():getId() < config.access then
            return false
        end
    end
    return true
end

in events.xml set enabled="1" for onMoveCreature

I put it on player? I got this script, it was a creaturescript.
 
you put it in data/events/scripts/player.lua
you replace the existing onMoveCreature with what i posted and enable onMoveCreature in events.xml
 
you put it in data/events/scripts/player.lua
you replace the existing onMoveCreature with what i posted and enable onMoveCreature in events.xml

the script works normally, but because it gives access to the player 3 not to be pushed, the anti-idle does not work. it can go out and stay in our trainer forever.
 
if you have gamemaster access you won't get kicked from anti idle, that has absolutely nothing to do with this script though so i don't understand why it's an issue related to this thread
 
if you have gamemaster access you won't get kicked from anti idle, that has absolutely nothing to do with this script though so i don't understand why it's an issue related to this thread
I think in the script it is giving access 3 to the player, maybe not to be pushed.

Code:
    access = 3

    if target then
        if isInArray(config.targetList, target:getName()) and self:getGroup():getId() < config.access then
 
Back
Top