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

Mixing Scripts

zednem

New Member
Joined
Nov 15, 2008
Messages
108
Reaction score
0
Hi, here i am again xD
Well i am with a problem, i want to mix 2 scripts, but i am doing something wrong =/.

So i want to mix 2 functions, a trainer space who summon 2 monk when player get in with a anti-bot system, but manting the functions check if player is in trainer and last player who used the trainer. There is my script of trainer that summons the 2 monks, check if have a player in trainer and says the last player who used the trainer, i want to put a anti-bot protection with it
i found a script of anti-bot, so please somebody help me to mix this scripts

http://otland.net/f81/advanced-training-system-anti-bot-protection-8986/



Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)

    -- Define positions.
    local charPos = getCreaturePosition(cid)
    local doorPos = getThingPos(item.uid)
    local monkOne = {x = doorPos.x + 3, y = doorPos.y + 1, z = doorPos.z}
    local monkTwo = {x = doorPos.x + 3, y = doorPos.y - 1, z = doorPos.z}
    local checkPlayer = {x = doorPos.x + 2, y = doorPos.y, z = doorPos.z, stackpos = 253}
    local checkPlayer1 = {x = doorPos.x + 1, y = doorPos.y, z = doorPos.z, stackpos = 253}
    -- Define directions.
    local newDir  = 1
    local oldDir  = 3
 
  -- Check where the player is located at.
    if ( charPos.x == doorPos.x - 1 and charPos.z == doorPos.z ) then
        -- Check if someone already uses the training booth.
        if isPlayer(getThingfromPos(checkPlayer).uid) == TRUE then
            doPlayerSendTextMessage(cid, 24, "Someone is already using this booth.")
            doSendMagicEffect(getCreaturePos(cid), 2)
        else
          -- Teleport player.
            doTeleportThing(cid, doorPos)
            doMoveCreature(cid, newDir)
            -- Summon training monks.
            doSummonCreature("Trainer", monkOne)
            doSummonCreature("Trainer", monkTwo)
        end

    else
        doTeleportThing(cid, doorPos)  
        doMoveCreature(cid, oldDir)
        -- Remove training monks.
        doRemoveCreature(getThingfromPos({x = monkOne.x, y = monkOne.y, z = monkOne.z, stackpos = 253}).uid)
        doRemoveCreature(getThingfromPos({x = monkTwo.x, y = monkTwo.y, z = monkTwo.z, stackpos = 253}).uid)
        doRemoveCreature(getThingfromPos({x = monkTwo.x - 1, y = monkTwo.y + 1, z = monkTwo.z, stackpos = 253}).uid)    
        -- Send magic effect.
        doSendMagicEffect(monkOne, 2)
        doSendMagicEffect(monkTwo, 2)
        -- Define last character.
        local charName = getCreatureName(cid)
        doSetItemSpecialDescription(getThingfromPos(doorPos).uid, "Last one to use this booth was player:\n" .. charName .. ".")
    end
    return TRUE

end
 
Back
Top