• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    [Mods] Paintball event 0.4/0.3.6pl1

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    1[Mods] Paintball event 0.4/0.3.6pl1 Empty [Mods] Paintball event 0.4/0.3.6pl1 Mar Ago 11, 2015 12:56 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Hola usuarios de tibiaface

    bueno aqui le traemos el famoso juego del Paintball. se trata de eliminar a tu openente con balas de pintura.

    bueno aqui dejamos un video para informacion lamentablemente el creador del evento habla ingles y el video obvio es ingles.



    Nos vamos a la carpeta mods de nuestro otcopiamos cualquier archivo y renombramos por Paintball.xml y pegamos esto dentro


    Código:
       

        <?xml version="1.0" encoding="UTF-8"?>
                <mod name="Paintball event" version="1.0" author="Bogart" contact="otland.net" enabled="yes">
                        <description>
                             
                        </description>
                        <config name="config"><![CDATA[
                        t = {
                                main = {
                                        tfs_version = "0.3", --0.3 or 0.4
                                        positions = {
                                                paintball_spawn_area = {
                                                        top_left = {x = 970, y = 1040, z = 4}, --Top left pos of spawning area
                                                        bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of spawning area
                                                },
                                                waiting_room_area = {
                                                        top_left = {x = 970, y = 1040, z = 7}, --Top left pos of the waiting room
                                                        bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of the waiting room
                                                },
                                                tp_to_paintball = {x = 985, y = 1052, z = 7}, --pos where the tp will be created
                                                event_ending_pos = {x = 985, y = 1052, z = 7} --pos players will be sent after event ending
                                        },
                                        storages = {
                                                exhaust = 2455,
                                                is_in_event = 2460,
                                                score = 2465
                                        },
                                        misc = {
                                                status = 'on'
                                        },
                                        messages = {
                                                event_started = "Paintball event has started! there's a teleport near Thais temple!",--Message that will be broadcasted after the event has started
                                                event_ended = "Paintball event has ended!" --same but when event ends
                                        },
                                        event_config = {
                                                event_duration = 15, --minutes, 0 if it's an always-open event
                                                infinite_ammo = false,
                                                winner_gets_item = true,
                                                prize_item_id = 3051,
                                                decrease_score_on_death = true,
                                                points_per_kill = 1,
                                                randomize_player_start_pos = true,
                                                ammo_per_point = 100,
                                                reset_bullets_on_death = true,
                                                min_bullets_on_spawn = 100,
                                                start_automatically = false,
                                                use_waiting_room = false,
                                                waiting_time = 3 --minutes
                                        }
                                },
                                onShoot = {
                                        storages = {
                                                ammo = 2400
                                        },
                                        misc = {
                                                walls_id = {1115,1111,1112,5258,1385,1113},
                                                bullets_exhaust = 500, --in ms
                                                bullet_speed = 150
                                        },
                                        vars = {
                                                shootdir = 0
                                        }
                                }
                        }
                        ]]></config>
                        <movevent type="StepIn" actionid ="2880" event="script"><![CDATA[
                        domodlib('config')
                        function onStepIn(cid, item, pos)
                                local t_l = t.main.positions.paintball_spawn_area.top_left
                                local b_r = t.main.positions.paintball_spawn_area.bottom_right
                                doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                doPlayerSetStorageValue(cid, t.main.storages.is_in_event,1)
                                doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                doPlayerSetStorageValue(cid, t.main.storages.score, 0)
                                doPlayerSendTextMessage(cid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                        end
                        ]]></movevent>
                        <globalevent name="StartPaintBall" interval="3600" event="script"><![CDATA[
                        domodlib('config')
                        function onThink(interval, lastExecution, thinkInterval)
                                if t.main.event_config.start_automatically then
                                        doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
                                        if t.main.event_config.use_waiting_room then
                                                addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60)
                                                doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
                                        else
                                                if t.main.tfs_version == "0.3" then
                                                        doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
                                                else
                                                        doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
                                                end
                                                if(t.main.event_config.event_duration > 0) then
                                                        addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                                                end
                                        end
                                end
                        return true
                        end
                     
                        function endPaintball()
                                local score = {}
                                if not t.main.event_config.use_waiting_room then
                                        doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                end
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
                                                table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
                                                doTeleportThing(pid, t.main.positions.event_ending_pos)
                                        end
                                end
                                table.sort(score, function(a, b) return a[2] > b[2] end)
                                if table.getn(score) > 0 then
                                        if t.main.event_config.winner_gets_item then
                                                for _, pid in ipairs(getPlayersOnline()) do
                                                        if getCreatureName(pid) == score[1][1] then
                                                                doPlayerAddItem(pid, t.main.event_config.prize_item_id)
                                                                break
                                                        end
                                                end
                                        end
                                        doBroadcastMessage("Paintball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING)
                                end
                        end
                        local t_l = t.main.positions.paintball_spawn_area.top_left
                        local b_r = t.main.positions.paintball_spawn_area.bottom_right
                        function moveToEvent()
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
                                                doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                                        end
                                end
                                doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                        end
                        ]]></globalevent>
                        <talkaction words="!shoot" event="script"><![CDATA[
                        domodlib('config')
                        function onSay(cid, words, param, channel)
                                local k = string.explode(param, ",")
                                if(k[1] ~= nil) then
                                        if(string.upper(k[1]) == 'END') and getPlayerGroupId(cid) >= 3 then
                                                endPaintball()
                                        end
                                        if(string.upper(k[1]) == 'START') and getPlayerGroupId(cid) >= 3 then
                                                doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
                                                if t.main.event_config.use_waiting_room then
                                                        addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60)
                                                        doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
                                                else
                                                        if t.main.tfs_version == "0.3" then
                                                                doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
                                                        else
                                                                doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
                                                        end
                                                        if(t.main.event_config.event_duration > 0) then
                                                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                                                        end
                                                end
                                        end
                                        if(string.upper(k[1]) == 'INFO') then
                                        local score = {}
                                        local output =  "You have " .. getPlayerStorageValue(cid, t.main.storages.score) .. " points.\nYou have "..getPlayerStorageValue(cid, t.onShoot.storages.ammo).." ammo left.\n------------------\nThe current high score in paintball is:\n"
                                                for _, pid in ipairs(getPlayersOnline()) do
                                                        if getPlayerStorageValue(pid, t.main.storages.is_in_event) then
                                                                table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                        end
                                                end
                                        local lx = table.getn(score)
                                        if(lx > 3) then lx = 3 end
                                                table.sort(score, function(a, b) return a[2] > b[2] end)
                                                for k = 1,lx do
                                                        output = output .. k..". "..score[k][1] .." [".. score[k][2] .."].\n"
                                                end
                                        doPlayerPopupFYI(cid, output)
                                        end
                                        if (string.upper(k[1]) == 'AMMO') then
                                                if(t.main.event_config.infinite_ammo) then
                                                        doPlayerSendTextMessage(cid, 27, "Ammo is infinite, there's no need to buy more.")
                                                else
                                                        if getPlayerStorageValue(cid, t.main.storages.score) > 0 then
                                                                doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
                                                                doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid,t.onShoot.storages.ammo)+t.main.event_config.ammo_per_point)
                                                                doPlayerSendTextMessage(cid, 27, "You have received " .. t.main.event_config.ammo_per_point .. " bullets and you have lost 1 score point.")
                                                                doSendMagicEffect(getCreaturePosition(cid),4)
                                                        else
                                                                doPlayerSendTextMessage(cid, 27, "You do not have enough score points to buy ammo, you need ".. 1-(getPlayerStorageValue(cid, t.main.storages.score)).. " more.")                     
                                                        end
                                                end
                                        end
                                        if (string.upper(k[1]) == 'BULLET') then
                                                if(getPlayerStorageValue(cid, t.main.storages.is_in_event) == 1) then
                                                        if getPlayerStorageValue(cid, t.main.storages.exhaust) <= 1 then
                                                                if(getPlayerStorageValue(cid, t.onShoot.storages.ammo) > 0) then
                                                                        if t.main.misc.status == 'on' then
                                                                                if(t.main.event_config.infinite_ammo == false) then
                                                                                        doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid, t.onShoot.storages.ammo)-1)
                                                                                end
                                                                                doPlayerSetStorageValue(cid, t.main.storages.exhaust, 2)
                                                                                lineAnimation(getPlayerLookDirection(cid),getCreaturePosition(cid),12,cid,1,0,1,0,0,0,1,0)
                                                                                addEvent(doPlayerSetStorageValue,t.onShoot.misc.bullets_exhaust, cid, t.main.storages.exhaust,1)
                                                                        else
                                                                                return false
                                                                        end
                                                                else
                                                                        doPlayerSendCancel(cid, "You're out of ammo, exchange ammo for points with !shoot ammo or get killed for a recharge.")
                                                                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)   
                                                                end
                                                        else
                                                                doPlayerSendCancel(cid, "Gun is on cooldown")
                                                                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                                                        end
                                                else
                                                        doPlayerSendCancel(cid, "You need to be in the event.")
                                                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                                                end
                                        end
                                end
                        return true
                        end
       
       
                        function lineAnimation(lookDir,playerPos,effect,cid,fvar,fpos,ffound,fposV,fcheck,fvcid,floopCounter,fvpid, name)
                        local var = fvar
                        local pos = fpos
                        local found = ffound
                        local posV = fposV
                        local check = fcheck
                        local vcid = fvcid
                        local loopCounter = floopCounter
                        local vpid = fvpid
                        local storage = t.main.storages.exhaust
                                if var < 2 then
                                        vcid = cid
                                end
                                pos = playerPos
                                if not isInWallArray(convert(lookDir,pos)) then--isInWallArray({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z}) then --isInArray(t.onShoot.misc.walls_id, getThingfromPos({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z, stackpos=0}).itemid) then
                                        doSendDistanceShoot(pos, convert(lookDir,pos),effect)
                                        pos = convert(lookDir,pos)
                                        var=var+1
                                        posV = convertV(lookDir,playerPos)
                                        for _, pid in ipairs(getPlayersOnline()) do
                                                if (getCreaturePosition(pid).x == pos.x and getCreaturePosition(pid).y == pos.y and getCreaturePosition(pid).z == pos.z) then
                                                        --if loopCounter > 2 then
                                                        vpid = pid
                                                        --end
                                                        if (vpid ~= vcid) then
                                                                if var > 2 then
                                                                        if (getCreaturePosition(pid).x == posV.x and getCreaturePosition(pid).y == posV.y and getCreaturePosition(pid).z == posV.z) then
                                                                                killPlayer(pid,pos,getCreatureName(vcid))
                                                                                if (lookDir == 0) or (lookDir == 2) then
                                                                                        var = 6
                                                                                else
                                                                                        var = 8
                                                                                end
                                                                        end
                                                                end
                                                                killPlayer(pid,pos,vcid)
                                                                if (lookDir == 0) or (lookDir == 2) then
                                                                        var = 6
                                                                else
                                                                        var = 8
                                                                end
                                                        end
                                                end
                                                loopCounter = loopCounter +1
                                        end   
                                        if (lookDir == 0) or (lookDir == 2) then
                                                if var ~= 6 then
                                                        addEvent(lineAnimation, t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
                                                else
                                                        var = 1
                                                end
                                        else
                                                if var ~= 8 then
                                                        addEvent(lineAnimation,  t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
                                                else
                                                        var = 1
                                                end
                                        end
                                else
                                        doSendMagicEffect(convert(lookDir,pos),2)
                                        var = 1
                                end
                        end
       
                        local ret = {}
                        function convert(lookDir,pos)
                        local positions = {
                                [0] = {x = pos.x, y = pos.y-1, z = pos.z},
                                [1] = {x = pos.x+1, y = pos.y, z = pos.z},
                                [2] = {x = pos.x, y = pos.y+1, z = pos.z},
                                [3] = {x = pos.x-1, y = pos.y, z = pos.z}
                                }
                                ret = positions[lookDir]
                        return ret
                        end
       
       
                        local ret = {}
                        function convertV(lookDir,pos)
                        local positions = {
                                [0] = {x = pos.x, y = pos.y+1, z = pos.z},
                                [1] = {x = pos.x-1, y = pos.y, z = pos.z},
                                [2] = {x = pos.x, y = pos.y-1, z = pos.z},
                                [3] = {x = pos.x+1, y = pos.y, z = pos.z}
                                }
                                ret = positions[lookDir]
                        return ret
                        end
                                     
                        function killPlayer(cid,pos, killer)
                                local t_l = t.main.positions.paintball_spawn_area.top_left
                                local b_r = t.main.positions.paintball_spawn_area.bottom_right
                                doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                doSendMagicEffect(pos,2)
                                doPlayerSendTextMessage(cid, 27, "You've been killed by "..getCreatureName(killer)..".")
                                doPlayerSetStorageValue(killer, t.main.storages.score, getPlayerStorageValue(killer, t.main.storages.score)+t.main.event_config.points_per_kill)
                                doPlayerSendTextMessage(killer, 27, "You've killed "..getCreatureName(cid)..".")
                                doBroadcastMessage("[Event] Paintball: "..getCreatureName(killer).." has killed "..getCreatureName(cid)..".", MESSAGE_STATUS_WARNING)
                                if t.main.event_config.decrease_score_on_death then
                                        doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
                                end
                                if t.main.event_config.reset_bullets_on_death then
                                        doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                end
                        end
                                                     
                        function isInWallArray(pos)
                                for k = 0, table.getn(t.onShoot.misc.walls_id) do
                                        if getTileItemById(pos, t.onShoot.misc.walls_id[k]).itemid == t.onShoot.misc.walls_id[k] then --this doesn't even make sense but tried other ways and it gave errors, so meh 2lazy2search
                                                return true   
                                        end
                                end
                                return false
                        end
                        function endPaintball()
                                local score = {}
                                if not t.main.event_config.use_waiting_room then
                                        doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                end
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
                                                table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
                                                doTeleportThing(pid, t.main.positions.event_ending_pos)
                                        end
                                end
                                table.sort(score, function(a, b) return a[2] > b[2] end)
                                if table.getn(score) > 0 then
                                        if t.main.event_config.winner_gets_item then
                                                for _, pid in ipairs(getPlayersOnline()) do
                                                        if getCreatureName(pid) == score[1][1] then
                                                                doPlayerAddItem(pid, t.main.event_config.prize_item_id)
                                                                break
                                                        end
                                                end
                                        end
                                doBroadcastMessage("Painball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING)
                                end
                        end
                        local t_l = t.main.positions.paintball_spawn_area.top_left
                        local b_r = t.main.positions.paintball_spawn_area.bottom_right
                        function moveToEvent()
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
                                                doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                                        end
                                end
                                doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                        end
                        ]]></talkaction>
                </mod>



    link del mapa: [Tienes que estar registrado y conectado para ver este vínculo]



    tomar en cuenta antes de la configuracion este cambio:

    hay tres linea que tienen que modificar:

    tfs_version = "0.3", --0.3 or 0.4 dependiendo del tfs si es 0.3 o 0.4


    Configuracion:
    Se refiere al area de respawn del player en el evento
    Código:
    paintball_spawn_area = {
     top_left = {x = 1079, y = 888, z = 7}, --posicion superior izquierdo del area del evento
     bottom_right = {x = 1107, y = 911, z = 7}--posicion inferior derecho del area del evento
     },
    ,


    Código:
    },
     tp_to_paintball = {x = 1110, y = 990, z = 7}, --configuracion de posicion de portal que te lleva al evento (generalmente esta en el templo)
     event_ending_pos = {x = 1108, y = 993, z = 7} --posicion donde te lleva al finalizar el tiempo del evento
     },


    Código:
                  event_config = {
                        event_duration = 0, -- tiempo en minutos, de duracion del evento
                        infinite_ammo = false, -- municion infinita (true)
                        winner_gets_item = true, -- si player ganador obtiene item
                        prize_item_id = 3051, -- id del item para player ganador
                        decrease_score_on_death = true, -- descuenta puntos al morir
                        points_per_kill = 1, -- puntos al matar a uno
                        ammo_per_point = 100, -- cuanta municion gana por punto
                        reset_bullets_on_death = true, -- recargar balas al morir
                        min_bullets_on_spawn = 100 -- minimo de balas al nacer
                    }

    Código:
    misc = {
                        walls_id = {1115,1111,1112,5258,1385,1113}, -- IDs de wall que bloquean balas
                        bullets_exhaust = 500, --en ms
                        bullet_speed = 150 -- velocidad de las balas
                    },

    Código:
                  messages = {
                        event_started = "Paintball event has started! there's a teleport near Thais temple!", -- mensaje al inciar event
                        event_ended = "Paintball event has ended!" -- mensaje al finalizar evento
                    }

    Código:
    Comandos en el evento:
    GMs
    !shoot start -- iniciar evento
    !shoot end -- finalizar evento
    Players
    !shoot bullet -- disparar
    !shoot ammo --recargar
    !shoot info -- informacion de balas y ranking de puntos


    creditos: Bogart



    [Mods] Paintball event 0.4/0.3.6pl1 YNU5B25
    +2
    liligenis
    [Admin] God Maya
    6 participantes
    http://www.tibiaface.com

    2[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Jue Oct 01, 2015 9:38 pm

    liligenis

    liligenis
    Nuevo Miembro
    Nuevo Miembro
    buenas y no creo mas nada? osea solo esa archivo ne la carpeta mods y ya? ya que hize todo lo que dijiste y ps nada cuando digo: !shoot star no sucede nad ani nada por el estilo

    +2
    liligenis
    [Admin] God Maya
    6 participantes
    https://www.facebook.com

    3[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Jue Oct 01, 2015 10:39 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    liligenis escribió:buenas y no creo mas nada? osea solo esa archivo ne la carpeta mods y ya? ya que hize todo lo que dijiste y ps nada cuando digo: !shoot star no sucede nad ani nada por el estilo

    que tfs estas usando o otx por que si es otx no te funcionara



    [Mods] Paintball event 0.4/0.3.6pl1 YNU5B25
    +2
    liligenis
    [Admin] God Maya
    6 participantes
    http://www.tibiaface.com

    4[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Jue Mar 25, 2021 10:15 pm

    GalaxyDev

    GalaxyDev
    Miembro
    Miembro
    [Admin] God Maya escribió:Hola usuarios de tibiaface

    bueno aqui le traemos el famoso juego del Paintball. se trata de eliminar a tu openente con balas de pintura.

    bueno aqui dejamos un video para informacion lamentablemente el creador del evento habla ingles y el video obvio es ingles.



    Nos vamos a la carpeta mods de nuestro otcopiamos cualquier archivo y renombramos por Paintball.xml y pegamos esto dentro


    Código:
       

        <?xml version="1.0" encoding="UTF-8"?>
                <mod name="Paintball event" version="1.0" author="Bogart" contact="otland.net" enabled="yes">
                        <description>
                             
                        </description>
                        <config name="config"><![CDATA[
                        t = {
                                main = {
                                        tfs_version = "0.3", --0.3 or 0.4
                                        positions = {
                                                paintball_spawn_area = {
                                                        top_left = {x = 970, y = 1040, z = 4}, --Top left pos of spawning area
                                                        bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of spawning area
                                                },
                                                waiting_room_area = {
                                                        top_left = {x = 970, y = 1040, z = 7}, --Top left pos of the waiting room
                                                        bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of the waiting room
                                                },
                                                tp_to_paintball = {x = 985, y = 1052, z = 7}, --pos where the tp will be created
                                                event_ending_pos = {x = 985, y = 1052, z = 7} --pos players will be sent after event ending
                                        },
                                        storages = {
                                                exhaust = 2455,
                                                is_in_event = 2460,
                                                score = 2465
                                        },
                                        misc = {
                                                status = 'on'
                                        },
                                        messages = {
                                                event_started = "Paintball event has started! there's a teleport near Thais temple!",--Message that will be broadcasted after the event has started
                                                event_ended = "Paintball event has ended!" --same but when event ends
                                        },
                                        event_config = {
                                                event_duration = 15, --minutes, 0 if it's an always-open event
                                                infinite_ammo = false,
                                                winner_gets_item = true,
                                                prize_item_id = 3051,
                                                decrease_score_on_death = true,
                                                points_per_kill = 1,
                                                randomize_player_start_pos = true,
                                                ammo_per_point = 100,
                                                reset_bullets_on_death = true,
                                                min_bullets_on_spawn = 100,
                                                start_automatically = false,
                                                use_waiting_room = false,
                                                waiting_time = 3 --minutes
                                        }
                                },
                                onShoot = {
                                        storages = {
                                                ammo = 2400
                                        },
                                        misc = {
                                                walls_id = {1115,1111,1112,5258,1385,1113},
                                                bullets_exhaust = 500, --in ms
                                                bullet_speed = 150
                                        },
                                        vars = {
                                                shootdir = 0
                                        }
                                }
                        }
                        ]]></config>
                        <movevent type="StepIn" actionid ="2880" event="script"><![CDATA[
                        domodlib('config')
                        function onStepIn(cid, item, pos)
                                local t_l = t.main.positions.paintball_spawn_area.top_left
                                local b_r = t.main.positions.paintball_spawn_area.bottom_right
                                doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                doPlayerSetStorageValue(cid, t.main.storages.is_in_event,1)
                                doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                doPlayerSetStorageValue(cid, t.main.storages.score, 0)
                                doPlayerSendTextMessage(cid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                        end
                        ]]></movevent>
                        <globalevent name="StartPaintBall" interval="3600" event="script"><![CDATA[
                        domodlib('config')
                        function onThink(interval, lastExecution, thinkInterval)
                                if t.main.event_config.start_automatically then
                                        doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
                                        if t.main.event_config.use_waiting_room then
                                                addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60)
                                                doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
                                        else
                                                if t.main.tfs_version == "0.3" then
                                                        doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
                                                else
                                                        doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
                                                end
                                                if(t.main.event_config.event_duration > 0) then
                                                        addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                                                end
                                        end
                                end
                        return true
                        end
                     
                        function endPaintball()
                                local score = {}
                                if not t.main.event_config.use_waiting_room then
                                        doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                end
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
                                                table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
                                                doTeleportThing(pid, t.main.positions.event_ending_pos)
                                        end
                                end
                                table.sort(score, function(a, b) return a[2] > b[2] end)
                                if table.getn(score) > 0 then
                                        if t.main.event_config.winner_gets_item then
                                                for _, pid in ipairs(getPlayersOnline()) do
                                                        if getCreatureName(pid) == score[1][1] then
                                                                doPlayerAddItem(pid, t.main.event_config.prize_item_id)
                                                                break
                                                        end
                                                end
                                        end
                                        doBroadcastMessage("Paintball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING)
                                end
                        end
                        local t_l = t.main.positions.paintball_spawn_area.top_left
                        local b_r = t.main.positions.paintball_spawn_area.bottom_right
                        function moveToEvent()
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
                                                doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                                        end
                                end
                                doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                        end
                        ]]></globalevent>
                        <talkaction words="!shoot" event="script"><![CDATA[
                        domodlib('config')
                        function onSay(cid, words, param, channel)
                                local k = string.explode(param, ",")
                                if(k[1] ~= nil) then
                                        if(string.upper(k[1]) == 'END') and getPlayerGroupId(cid) >= 3 then
                                                endPaintball()
                                        end
                                        if(string.upper(k[1]) == 'START') and getPlayerGroupId(cid) >= 3 then
                                                doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
                                                if t.main.event_config.use_waiting_room then
                                                        addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60)
                                                        doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
                                                else
                                                        if t.main.tfs_version == "0.3" then
                                                                doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
                                                        else
                                                                doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
                                                        end
                                                        if(t.main.event_config.event_duration > 0) then
                                                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                                                        end
                                                end
                                        end
                                        if(string.upper(k[1]) == 'INFO') then
                                        local score = {}
                                        local output =  "You have " .. getPlayerStorageValue(cid, t.main.storages.score) .. " points.\nYou have "..getPlayerStorageValue(cid, t.onShoot.storages.ammo).." ammo left.\n------------------\nThe current high score in paintball is:\n"
                                                for _, pid in ipairs(getPlayersOnline()) do
                                                        if getPlayerStorageValue(pid, t.main.storages.is_in_event) then
                                                                table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                        end
                                                end
                                        local lx = table.getn(score)
                                        if(lx > 3) then lx = 3 end
                                                table.sort(score, function(a, b) return a[2] > b[2] end)
                                                for k = 1,lx do
                                                        output = output .. k..". "..score[k][1] .." [".. score[k][2] .."].\n"
                                                end
                                        doPlayerPopupFYI(cid, output)
                                        end
                                        if (string.upper(k[1]) == 'AMMO') then
                                                if(t.main.event_config.infinite_ammo) then
                                                        doPlayerSendTextMessage(cid, 27, "Ammo is infinite, there's no need to buy more.")
                                                else
                                                        if getPlayerStorageValue(cid, t.main.storages.score) > 0 then
                                                                doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
                                                                doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid,t.onShoot.storages.ammo)+t.main.event_config.ammo_per_point)
                                                                doPlayerSendTextMessage(cid, 27, "You have received " .. t.main.event_config.ammo_per_point .. " bullets and you have lost 1 score point.")
                                                                doSendMagicEffect(getCreaturePosition(cid),4)
                                                        else
                                                                doPlayerSendTextMessage(cid, 27, "You do not have enough score points to buy ammo, you need ".. 1-(getPlayerStorageValue(cid, t.main.storages.score)).. " more.")                     
                                                        end
                                                end
                                        end
                                        if (string.upper(k[1]) == 'BULLET') then
                                                if(getPlayerStorageValue(cid, t.main.storages.is_in_event) == 1) then
                                                        if getPlayerStorageValue(cid, t.main.storages.exhaust) <= 1 then
                                                                if(getPlayerStorageValue(cid, t.onShoot.storages.ammo) > 0) then
                                                                        if t.main.misc.status == 'on' then
                                                                                if(t.main.event_config.infinite_ammo == false) then
                                                                                        doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, getPlayerStorageValue(cid, t.onShoot.storages.ammo)-1)
                                                                                end
                                                                                doPlayerSetStorageValue(cid, t.main.storages.exhaust, 2)
                                                                                lineAnimation(getPlayerLookDirection(cid),getCreaturePosition(cid),12,cid,1,0,1,0,0,0,1,0)
                                                                                addEvent(doPlayerSetStorageValue,t.onShoot.misc.bullets_exhaust, cid, t.main.storages.exhaust,1)
                                                                        else
                                                                                return false
                                                                        end
                                                                else
                                                                        doPlayerSendCancel(cid, "You're out of ammo, exchange ammo for points with !shoot ammo or get killed for a recharge.")
                                                                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)   
                                                                end
                                                        else
                                                                doPlayerSendCancel(cid, "Gun is on cooldown")
                                                                doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                                                        end
                                                else
                                                        doPlayerSendCancel(cid, "You need to be in the event.")
                                                        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
                                                end
                                        end
                                end
                        return true
                        end
       
       
                        function lineAnimation(lookDir,playerPos,effect,cid,fvar,fpos,ffound,fposV,fcheck,fvcid,floopCounter,fvpid, name)
                        local var = fvar
                        local pos = fpos
                        local found = ffound
                        local posV = fposV
                        local check = fcheck
                        local vcid = fvcid
                        local loopCounter = floopCounter
                        local vpid = fvpid
                        local storage = t.main.storages.exhaust
                                if var < 2 then
                                        vcid = cid
                                end
                                pos = playerPos
                                if not isInWallArray(convert(lookDir,pos)) then--isInWallArray({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z}) then --isInArray(t.onShoot.misc.walls_id, getThingfromPos({x=convert(lookDir,pos).x, y=convert(lookDir,pos).y,z=convert(lookDir,pos).z, stackpos=0}).itemid) then
                                        doSendDistanceShoot(pos, convert(lookDir,pos),effect)
                                        pos = convert(lookDir,pos)
                                        var=var+1
                                        posV = convertV(lookDir,playerPos)
                                        for _, pid in ipairs(getPlayersOnline()) do
                                                if (getCreaturePosition(pid).x == pos.x and getCreaturePosition(pid).y == pos.y and getCreaturePosition(pid).z == pos.z) then
                                                        --if loopCounter > 2 then
                                                        vpid = pid
                                                        --end
                                                        if (vpid ~= vcid) then
                                                                if var > 2 then
                                                                        if (getCreaturePosition(pid).x == posV.x and getCreaturePosition(pid).y == posV.y and getCreaturePosition(pid).z == posV.z) then
                                                                                killPlayer(pid,pos,getCreatureName(vcid))
                                                                                if (lookDir == 0) or (lookDir == 2) then
                                                                                        var = 6
                                                                                else
                                                                                        var = 8
                                                                                end
                                                                        end
                                                                end
                                                                killPlayer(pid,pos,vcid)
                                                                if (lookDir == 0) or (lookDir == 2) then
                                                                        var = 6
                                                                else
                                                                        var = 8
                                                                end
                                                        end
                                                end
                                                loopCounter = loopCounter +1
                                        end   
                                        if (lookDir == 0) or (lookDir == 2) then
                                                if var ~= 6 then
                                                        addEvent(lineAnimation, t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
                                                else
                                                        var = 1
                                                end
                                        else
                                                if var ~= 8 then
                                                        addEvent(lineAnimation,  t.onShoot.misc.bullet_speed, lookDir,pos,effect,nil,var,pos,found,posV,check,vcid,loopCounter,vpid)
                                                else
                                                        var = 1
                                                end
                                        end
                                else
                                        doSendMagicEffect(convert(lookDir,pos),2)
                                        var = 1
                                end
                        end
       
                        local ret = {}
                        function convert(lookDir,pos)
                        local positions = {
                                [0] = {x = pos.x, y = pos.y-1, z = pos.z},
                                [1] = {x = pos.x+1, y = pos.y, z = pos.z},
                                [2] = {x = pos.x, y = pos.y+1, z = pos.z},
                                [3] = {x = pos.x-1, y = pos.y, z = pos.z}
                                }
                                ret = positions[lookDir]
                        return ret
                        end
       
       
                        local ret = {}
                        function convertV(lookDir,pos)
                        local positions = {
                                [0] = {x = pos.x, y = pos.y+1, z = pos.z},
                                [1] = {x = pos.x-1, y = pos.y, z = pos.z},
                                [2] = {x = pos.x, y = pos.y-1, z = pos.z},
                                [3] = {x = pos.x+1, y = pos.y, z = pos.z}
                                }
                                ret = positions[lookDir]
                        return ret
                        end
                                     
                        function killPlayer(cid,pos, killer)
                                local t_l = t.main.positions.paintball_spawn_area.top_left
                                local b_r = t.main.positions.paintball_spawn_area.bottom_right
                                doTeleportThing(cid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                doSendMagicEffect(pos,2)
                                doPlayerSendTextMessage(cid, 27, "You've been killed by "..getCreatureName(killer)..".")
                                doPlayerSetStorageValue(killer, t.main.storages.score, getPlayerStorageValue(killer, t.main.storages.score)+t.main.event_config.points_per_kill)
                                doPlayerSendTextMessage(killer, 27, "You've killed "..getCreatureName(cid)..".")
                                doBroadcastMessage("[Event] Paintball: "..getCreatureName(killer).." has killed "..getCreatureName(cid)..".", MESSAGE_STATUS_WARNING)
                                if t.main.event_config.decrease_score_on_death then
                                        doPlayerSetStorageValue(cid, t.main.storages.score, getPlayerStorageValue(cid, t.main.storages.score)-1)
                                end
                                if t.main.event_config.reset_bullets_on_death then
                                        doPlayerSetStorageValue(cid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                end
                        end
                                                     
                        function isInWallArray(pos)
                                for k = 0, table.getn(t.onShoot.misc.walls_id) do
                                        if getTileItemById(pos, t.onShoot.misc.walls_id[k]).itemid == t.onShoot.misc.walls_id[k] then --this doesn't even make sense but tried other ways and it gave errors, so meh 2lazy2search
                                                return true   
                                        end
                                end
                                return false
                        end
                        function endPaintball()
                                local score = {}
                                if not t.main.event_config.use_waiting_room then
                                        doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                end
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
                                                table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
                                                doTeleportThing(pid, t.main.positions.event_ending_pos)
                                        end
                                end
                                table.sort(score, function(a, b) return a[2] > b[2] end)
                                if table.getn(score) > 0 then
                                        if t.main.event_config.winner_gets_item then
                                                for _, pid in ipairs(getPlayersOnline()) do
                                                        if getCreatureName(pid) == score[1][1] then
                                                                doPlayerAddItem(pid, t.main.event_config.prize_item_id)
                                                                break
                                                        end
                                                end
                                        end
                                doBroadcastMessage("Painball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING)
                                end
                        end
                        local t_l = t.main.positions.paintball_spawn_area.top_left
                        local b_r = t.main.positions.paintball_spawn_area.bottom_right
                        function moveToEvent()
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
                                                doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                                        end
                                end
                                doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                        end
                        ]]></talkaction>
                </mod>



    link del mapa: [Tienes que estar registrado y conectado para ver este vínculo]



    tomar en cuenta antes de la configuracion este cambio:

    hay tres linea que tienen que modificar:

    tfs_version = "0.3", --0.3 or 0.4 dependiendo del tfs si es 0.3 o 0.4


    Configuracion:
    Se refiere al area de respawn del player en el evento
    Código:
    paintball_spawn_area = {
     top_left = {x = 1079, y = 888, z = 7}, --posicion superior izquierdo del area del evento
     bottom_right = {x = 1107, y = 911, z = 7}--posicion inferior derecho del area del evento
     },
    ,


    Código:
    },
     tp_to_paintball = {x = 1110, y = 990, z = 7}, --configuracion de posicion de portal que te lleva al evento (generalmente esta en el templo)
     event_ending_pos = {x = 1108, y = 993, z = 7} --posicion donde te lleva al finalizar el tiempo del evento
     },


    Código:
                  event_config = {
                        event_duration = 0, -- tiempo en minutos, de duracion del evento
                        infinite_ammo = false, -- municion infinita (true)
                        winner_gets_item = true, -- si player ganador obtiene item
                        prize_item_id = 3051, -- id del item para player ganador
                        decrease_score_on_death = true, -- descuenta puntos al morir
                        points_per_kill = 1, -- puntos al matar a uno
                        ammo_per_point = 100, -- cuanta municion gana por punto
                        reset_bullets_on_death = true, -- recargar balas al morir
                        min_bullets_on_spawn = 100 -- minimo de balas al nacer
                    }

    Código:
    misc = {
                        walls_id = {1115,1111,1112,5258,1385,1113}, -- IDs de wall que bloquean balas
                        bullets_exhaust = 500, --en ms
                        bullet_speed = 150 -- velocidad de las balas
                    },

    Código:
                  messages = {
                        event_started = "Paintball event has started! there's a teleport near Thais temple!", -- mensaje al inciar event
                        event_ended = "Paintball event has ended!" -- mensaje al finalizar evento
                    }

    Código:
    Comandos en el evento:
    GMs
    !shoot start -- iniciar evento
    !shoot end -- finalizar evento
    Players
    !shoot bullet -- disparar
    !shoot ammo --recargar
    !shoot info -- informacion de balas y ranking de puntos


    creditos: Bogart



    FUNCIONO EN OTX2 AMIGO MAYA MUCHAS GRACIAS



    [Tienes que estar registrado y conectado para ver este vínculo] Servidor 24/7 Full Animes  Smile    MI GITHUB (REVSCRIPTS TFS 1.3-1.5))
    +2
    liligenis
    [Admin] God Maya
    6 participantes

    5[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Jue Mayo 06, 2021 3:28 pm

    ioke

    ioke
    Miembro
    Miembro
    necesito hacelro que sea automatico cada cierta hora y ademas no se porque termina cuando quiere el resto funciona todo correcto

    +2
    liligenis
    [Admin] God Maya
    6 participantes
    http://baiakciteron.sytes.net

    6[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Jue Mayo 06, 2021 4:20 pm

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    ioke escribió:necesito hacelro que sea automatico cada cierta hora y ademas no se porque termina cuando quiere el resto funciona todo correcto


    ES AUTOMATICO SOLO HAY QUE COFIGURAR LA OPCION DE SI

    start_automatically = false, ------- CAMBIE POR true

    Código:

     <globalevent name="StartPaintBall" interval="3600" event="script"><![CDATA[
                        domodlib('config')
                        function onThink(interval, lastExecution, thinkInterval)
                                if t.main.event_config.start_automatically then
                                        doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
                                        if t.main.event_config.use_waiting_room then
                                                addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60)
                                                doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
                                        else
                                                if t.main.tfs_version == "0.3" then
                                                        doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
                                                else
                                                        doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
                                                end
                                                if(t.main.event_config.event_duration > 0) then
                                                        addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                                                end
                                        end
                                end
                        return true
                        end
                     
                        function endPaintball()
                                local score = {}
                                if not t.main.event_config.use_waiting_room then
                                        doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                end
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
                                                table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
                                                doTeleportThing(pid, t.main.positions.event_ending_pos)
                                        end
                                end
                                table.sort(score, function(a, b) return a[2] > b[2] end)
                                if table.getn(score) > 0 then
                                        if t.main.event_config.winner_gets_item then
                                                for _, pid in ipairs(getPlayersOnline()) do
                                                        if getCreatureName(pid) == score[1][1] then
                                                                doPlayerAddItem(pid, t.main.event_config.prize_item_id)
                                                                break
                                                        end
                                                end
                                        end
                                        doBroadcastMessage("Paintball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING)
                                end
                        end
                        local t_l = t.main.positions.paintball_spawn_area.top_left
                        local b_r = t.main.positions.paintball_spawn_area.bottom_right
                        function moveToEvent()
                                for _, pid in ipairs(getPlayersOnline()) do
                                        if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
                                                doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                                doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
                                                doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                                doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                                        end
                                end
                                doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                        end
                        ]]></globalevent>



    [Mods] Paintball event 0.4/0.3.6pl1 YNU5B25
    +2
    liligenis
    [Admin] God Maya
    6 participantes
    http://www.tibiaface.com

    7[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Jue Mayo 06, 2021 5:13 pm

    ioke

    ioke
    Miembro
    Miembro
    Ya peor lo quiero por time no por intervalo esque mi OT no sé porque los intervalos los hace muy cortos 3600 es como si fueran 2 segundos



    maya se puede crear un talkaction que se execute automático? para poner !shoot start



    listo lo consegui edite esta parte
    Código:
    <globalevent name="StartPaintBall" time="02:23" event="script"><![CDATA[
          domodlib('config')
          function onTime()

    pero me gustaria añadir mas horas diferentes

    +2
    liligenis
    [Admin] God Maya
    6 participantes
    http://baiakciteron.sytes.net

    8[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Vie Mayo 07, 2021 8:40 am

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    ioke escribió:Ya peor lo quiero por time no por intervalo esque mi OT no sé porque los intervalos los hace muy cortos 3600 es como si fueran 2 segundos



    maya se puede crear un talkaction que se execute automático? para poner !shoot start



    listo lo consegui edite esta parte
    Código:
    <globalevent name="StartPaintBall" time="02:23" event="script"><![CDATA[
     domodlib('config')
     function onTime()

    pero me gustaria añadir mas horas diferentes



    aqui tienes el global events para que lo agregue en data/globalevents/scripts y luego le pone una linea o tag en globalevents.xml con el tiempo que quiera usted que se ejecute.

    Código:


            
    ---------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------
    -esta seccion de local t puedes copiarla la del mod que tiene para que no te varie la configuracion-
    ---------------------------------------------------------------------------------------------------
    ---------------------------------------------------------------------------------------------------

    local t = {
                                main = {
                                        tfs_version = "0.3", --0.3 or 0.4
                                        positions = {
                                                paintball_spawn_area = {
                                                        top_left = {x = 970, y = 1040, z = 4}, --Top left pos of spawning area
                                                        bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of spawning area
                                                },
                                                waiting_room_area = {
                                                        top_left = {x = 970, y = 1040, z = 7}, --Top left pos of the waiting room
                                                        bottom_right = {x = 975, y = 1046, z = 7}--bottom right pos of the waiting room
                                                },
                                                tp_to_paintball = {x = 985, y = 1052, z = 7}, --pos where the tp will be created
                                                event_ending_pos = {x = 985, y = 1052, z = 7} --pos players will be sent after event ending
                                        },
                                        storages = {
                                                exhaust = 2455,
                                                is_in_event = 2460,
                                                score = 2465
                                        },
                                        misc = {
                                                status = 'on'
                                        },
                                        messages = {
                                                event_started = "Paintball event has started! there's a teleport near Thais temple!",--Message that will be broadcasted after the event has started
                                                event_ended = "Paintball event has ended!" --same but when event ends
                                        },
                                        event_config = {
                                                event_duration = 15, --minutes, 0 if it's an always-open event
                                                infinite_ammo = false,
                                                winner_gets_item = true,
                                                prize_item_id = 3051,
                                                decrease_score_on_death = true,
                                                points_per_kill = 1,
                                                randomize_player_start_pos = true,
                                                ammo_per_point = 100,
                                                reset_bullets_on_death = true,
                                                min_bullets_on_spawn = 100,
                                                start_automatically = false,
                                                use_waiting_room = false,
                                                waiting_time = 3 --minutes
                                        }
                                },
                                onShoot = {
                                        storages = {
                                                ammo = 2400
                                        },
                                        misc = {
                                                walls_id = {1115,1111,1112,5258,1385,1113},
                                                bullets_exhaust = 500, --in ms
                                                bullet_speed = 150
                                        },
                                        vars = {
                                                shootdir = 0
                                        }
                                }
                        }


















                                function onThink(interval, lastExecution, thinkInterval)
     
     
     
     
     
     
     
     
     local function endPaintball()
                                        local score = {}
                                        if not t.main.event_config.use_waiting_room then
                                                doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                        end
                                        for _, pid in ipairs(getPlayersOnline()) do
                                                if getPlayerStorageValue(pid, t.main.storages.is_in_event) > 0 then
                                                        table.insert(score, {getCreatureName(pid), getPlayerStorageValue(pid, t.main.storages.score)})
                                                        doPlayerSetStorageValue(pid, t.main.storages.is_in_event, 0)
                                                        doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                        doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, 0)
                                                        doTeleportThing(pid, t.main.positions.event_ending_pos)
                                                end
                                        end
                                        table.sort(score, function(a, b) return a[2] > b[2] end)
                                        if table.getn(score) > 0 then
                                                if t.main.event_config.winner_gets_item then
                                                        for _, pid in ipairs(getPlayersOnline()) do
                                                                if getCreatureName(pid) == score[1][1] then
                                                                        doPlayerAddItem(pid, t.main.event_config.prize_item_id)
                                                                        break
                                                                end
                                                        end
                                                end
                                                doBroadcastMessage("Paintball event has ended, "..score[1][1].." won paintball event with "..score[1][2].." points", MESSAGE_STATUS_WARNING)
                                        end
                                end
                                local t_l = t.main.positions.paintball_spawn_area.top_left
                                local b_r = t.main.positions.paintball_spawn_area.bottom_right
     
     
     
                                local function moveToEvent()
                                        for _, pid in ipairs(getPlayersOnline()) do
                                                if isInRange(getCreaturePosition(pid), t.main.positions.waiting_room_area.top_left, t.main.positions.waiting_room_area.bottom_right) then
                                                        doTeleportThing(pid, {x=math.random(t_l.x,b_r.x), y=math.random(t_l.y, b_r.y), z=math.random(t_l.z, b_r.z)})
                                                        doPlayerSetStorageValue(pid, t.main.storages.is_in_event,1)
                                                        doPlayerSetStorageValue(pid, t.onShoot.storages.ammo, t.main.event_config.min_bullets_on_spawn)
                                                        doPlayerSetStorageValue(pid, t.main.storages.score, 0)
                                                        doPlayerSendTextMessage(pid,27,"Welcome to paintball, here are the commands:\n!shoot bullet --This will shot a bullet.\n!shoot ammo --This will give you "..t.main.event_config.ammo_per_point.." bullets and take 1 point from your current score (you need at least 1 point to use this command).\n!shoot info --This will show you your current score and ammo, it'll also show the current high score of the event.\nIt is strongly recommended that you bind these commands to your hotkeys.")
                                                end
                                        end
                                        doRemoveItem(getTileItemById(t.main.positions.tp_to_paintball,1387).uid)
                                        addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                                end
     
     

     
                                        if t.main.event_config.start_automatically then
                                                doBroadcastMessage(t.main.messages.event_started, MESSAGE_STATUS_WARNING)
                                                if t.main.event_config.use_waiting_room then
                                                        addEvent(moveToEvent, t.main.event_config.waiting_time*1000*60)
                                                        doCreateTeleport(1387,t.main.positions.waiting_room_area.top_left, t.main.positions.tp_to_paintball)
                                                else
                                                        if t.main.tfs_version == "0.3" then
                                                                doItemSetAttribute(doCreateItem(1387, t.main.positions.tp_to_paintball), "aid", 2880)
                                                        else
                                                                doSetItemActionId(doCreateItem(1387, t.main.positions.tp_to_paintball),2880)
                                                        end
                                                        if(t.main.event_config.event_duration > 0) then
                                                                addEvent(endPaintball, t.main.event_config.event_duration*1000*60)
                                                        end
                                                end
                                        end
                                return true
                                end
                              
                                



    [Mods] Paintball event 0.4/0.3.6pl1 YNU5B25
    +2
    liligenis
    [Admin] God Maya
    6 participantes
    http://www.tibiaface.com

    9[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Vie Mayo 07, 2021 2:32 pm

    ioke

    ioke
    Miembro
    Miembro
    Muchas gracias me ha ido genial

    +2
    liligenis
    [Admin] God Maya
    6 participantes
    http://baiakciteron.sytes.net

    10[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Dom Oct 24, 2021 5:20 pm

    test1234

    test1234
    Nuevo Miembro
    Nuevo Miembro
    ioke escribió:Muchas gracias me ha ido genial
    Namas pa que sepas porque 3600 pasa rapido en tu servidor, es porque tu servidor se basa en milisegundos... 3600 (una hr en segundos) lo debes de cambiar a 3600000

    +2
    liligenis
    [Admin] God Maya
    6 participantes

    11[Mods] Paintball event 0.4/0.3.6pl1 Empty Re: [Mods] Paintball event 0.4/0.3.6pl1 Mar Ene 30, 2024 11:41 am

    Zero00

    Zero00
    Nuevo Miembro
    Nuevo Miembro
    me sale este error[Mods] Paintball event 0.4/0.3.6pl1 Error11

    +2
    liligenis
    [Admin] God Maya
    6 participantes

    Contenido patrocinado


    +2
    liligenis
    [Admin] God Maya
    6 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).