• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [Talkactions] Regalar item a todos los player online

    Compartir:

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

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Este script trata de ejecutar un comando para regalar un ítem a todos los player online como ejemplo: /ta 2160, 100

    instalacion:

    nos vamos a:

                   
    [Talkactions] Regalar item a todos los player online Note10data\creaturescripts\creaturescripts.xml
    y añadimos esta tag:

    Código:
    <talkaction words="!ta;/ta" access="4" event="script" value="createitemall.lua"/>


    Seguidamente no dirigimos a:

                   
    [Talkactions] Regalar item a todos los player online Note10data\creaturescripts\scripts
    Copiamos cualquier archivo y renoombramos por createitemall.lua y pegamos esto dentro:

    Código:
    function onSay(cid, words, param, channel)
    if(param == '') then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
    return true
    end
    for _, pid in ipairs(getPlayersOnline()) do
    local t = string.explode(param, ",")
    local ret = RETURNVALUE_NOERROR
    local pos = getCreaturePosition(cid)
     
    local id = tonumber(t[1])
    if(not id) then
    errors(false)
    id = getItemIdByName(t[1])
    errors(true)
     
    if(not id) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")
    return true
    end
    end
     
    amount = t[2]
    if(not t[2]) then
    amount = 1
    end
     
    local item = doCreateItemEx(id, amount)
    if(t[3] and getBooleanFromString(t[3])) then
    if(t[4] and getBooleanFromString(t[4])) then
    pos = getCreatureLookPosition(cid)
    end
     
    ret = doTileAddItemEx(pos, item)
    else
    doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "O "..getCreatureName(cid).." deu ("..amount.."x) "..getItemNameById(id).." para todos os players online.")
    ret = doPlayerAddItemEx(pid, item, true)
    end
     
    if(ret ~= RETURNVALUE_NOERROR) then
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])
    return true
    end
     
    doDecayItem(item)
    if(not isPlayerGhost(cid)) then
    doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
    end
    end
    return true
    end

    Creditos:
    JackXan
    Bruno Carvalho



    [Talkactions] Regalar item a todos los player online YNU5B25
    2 participantes
    http://www.tibiaface.com

    Nemesis811

    Nemesis811
    Miembro
    Miembro
    yo quiero algo parecido god maya pero como un reward que le den a los player por cada hora que este online que le de un items aleatorio existe la posibilidad mi ot es 8.70

    2 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    Nemesis811 escribió:yo quiero algo parecido god maya pero como un reward que le den a los player por cada hora que este online que le de un items aleatorio existe la posibilidad mi ot es 8.70

    aqui lo tienes

    Código:


    <event type="login" name="itemLogin" event="script" value="*****.lua"/>
    <event type="logout" name="itemLogout" event="script" value="*****.lua"/>


    Código:
    registerCreatureEvent(cid, "itemLogin")
    registerCreatureEvent(cid, "itemLogout")

    Código:

    local items = {
        [1] = {
            itemid = 2160,
            count = 1,
        },
        [2] = {
            itemid = 2160,
            count = 2
        }
    }

    local events = {}

    local function addReward(cid, rewardId)
        if not isPlayer(cid) then
            return
        end
        local item = items[rewardId or #items]
        doPlayerAddItem(cid, item.itemid, item.count)
        events[cid] = addEvent(addReward, 60 * 60 * 1000, cid, rewardId + 1)
    end

    function onLogin(cid)
        events[cid] = addEvent(addReward, 60 * 60 * 1000, cid, 1)
        return true
    end

    function onLogout(cid)
        if events[cid] then
            stopEvent(events[cid])
            events[cid] = nil
        end
        return true
    end



    todo esta en creaturescripts



    [Talkactions] Regalar item a todos los player online YNU5B25
    2 participantes
    http://www.tibiaface.com

    Nemesis811

    Nemesis811
    Miembro
    Miembro
    gracias en lo que llegue del trabajo lo pruebo y te aviso

    2 participantes

    Contenido patrocinado


    2 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).