BlackTibia

No estás conectado. Conéctate o registrate

 » Open Tibia » Pedido de Scripts » 

Me Ayudan

Me Ayudan

#1 Me Ayudan el Miér Sep 28, 2016 8:14 pm

extefania


Estudiante
Cordiales Saludos Comunidad de BlackTibia  Disculpame que moleste pero necesito Ayuda por favor no me dejen en visto HELP

Explicacion

Bueno estas cosas me gustarían editarlas o agregarlas:

-Al momento de cargar las posiones no hay un limite de Storage, que quiero decir...

Yo puedo cargas las potions que quiera, claro teniendo dinero para recargar...
Me Gustaría que existiera un limite (3000 como máximo) si se puede..



Código:
<talkaction words="!cargar" event="script" value="potions.lua"/>

Código:

function onSay(cid, words, param, channel)
--configuration --
    local items =
   {
     ['hp'] = {cost = 45, storage = 49989},
     ['shp'] = {cost = 100, storage = 49988},
     ['ghp'] = {cost = 190, storage = 49987},
     ['uhp'] = {cost = 310, storage = 49986},
     ['mp'] = {cost = 50, storage = 49985},
     ['smp'] = {cost = 80, storage = 49984},
     ['gmp'] = {cost = 120, storage = 49983},
    ['gsp'] = {cost = 190, storage = 49982}
    }    
-- Fin configuration --    
 
   local t = string.explode(param, ",")
    local item = items[t[1]]
    local amount = tonumber(t[2])    
 
   -- Checks if we can buy that itemname --
    if item then
        -- Checks if the player has enough money --
        if doPlayerRemoveMoney(cid, item.cost*amount) == LUA_NO_ERROR then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have bought '..amount..' '..t[1]..' charges for '..(item.cost*amount)..' golden pieces.')
            setPlayerStorageValue(cid, item.storage, getPlayerStorageValue(cid, item.storage)+amount)
        else
            doPlayerSendCancel(cid, 'You dont have enough money to buy that many charges.')
            doSendMagicEffect(getPlayerPosition (cid), CONST_ME_POFF)    
        end
    else            
        -- Sends the player a message wich includes items he can buy --
        text = "Charges you can buy:\n"
        -- Getting the all itemnames and prics --
        for item1 in pairs (items) do    
            -- Sends a message with each itemname and price --
            text = text .. "\n" .. item1
        end
        text = text .. "\n\nexample: type '!charges gmp,100' para comprar 100 gmp."
        doPlayerPopupFYI(cid, text)
    end
    return true
    end

Código:
local config = {
    removeOnUse = "no",
    usableOnTarget = "yes", -- can be used on target? (fe. healing friend)
    splashable = "no",
    realAnimation = "no", -- make text effect visible only for players in range 1x1
    healthMultiplier = 1.0,
    manaMultiplier = 1.0
}
 
config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)
 
local POTIONS = {
    [8704] = {empty = 7636, splash = 2, health = {50, 100}, storage = 49990}, -- small health potion
    [7618] = {empty = 7636, splash = 2, health = {100, 200}, storage = 49989}, -- health potion
    [7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins", storage = 49988}, -- strong health potion
    [7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights", storage = 49987}, -- great health potion
    [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights", storage = 49986}, -- ultimate health potion
 
    [7620] = {empty = 7636, splash = 7, mana = {70, 130}, storage = 49985}, -- mana potion
    [7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins", storage = 49984}, -- strong mana potion
    [7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids", storage = 49983}, -- great mana potion
 
    [8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins", storage = 49982} -- great spirit potion
}
 
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local potion = POTIONS[item.itemid]
    if(not potion) then
        return false
    end
 
    if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
        if(not config.splashable) then
            return false
        end
 
        if(toPosition.x == CONTAINER_POSITION) then
            toPosition = getThingPos(item.uid)
        end
 
        doDecayItem(doCreateItem(2016, potion.splash, toPosition))
        doTransformItem(item.uid, potion.empty)
        return true
    end
 
    if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
        return true
    end
 
    if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
        not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
    then
        doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return true
    end
 
        local health = potion.health
        if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
            return false
        end
 
        local mana = potion.mana
        if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
            return false
        end
        setPlayerStorageValue(cid, potion.storage, getPlayerStorageValue(cid, potion.storage)-1)
        doPlayerSendTextMessage(cid, 19, "Haz usado una potion de "..getPlayerStorageValue(cid, potion.storage).." charges.")
    else
        doPlayerSendTextMessage(cid, 19, "Se te han acabado las cargas, compra mas diciendo: !charges |type|,|amount|.")
        return false
    end
 
 
 
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    if(not realAnimation) then
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    else
        for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
            if(isPlayer(tid)) then
                doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
            end
        end
    end
 
 
    doAddCondition(cid, exhaust)
    return true
end



Última edición por extefania el Sáb Oct 01, 2016 10:45 am, editado 2 veces

http://www.facebook.com/china.bella.184?ref=tn_tnmn

#2 Re: Me Ayudan el Vie Sep 30, 2016 6:36 pm

CyberM


Scripter
Código:

--configuration --
local items = {
    ['hp'] = {cost = 45, storage = 49989, limit = 1},
    ['shp'] = {cost = 100, storage = 49988, limit = 2},
    ['ghp'] = {cost = 190, storage = 49987, limit = 3},
    ['uhp'] = {cost = 310, storage = 49986, limit = 4},
    ['mp'] = {cost = 50, storage = 49985, limit = 5},
    ['smp'] = {cost = 80, storage = 49984, limit = 6},
    ['gmp'] = {cost = 120, storage = 49983, limit = 7},
    ['gsp'] = {cost = 190, storage = 49982, limit = 8}
}   
-- Fin configuration --   

function onSay(cid, words, param, channel)
 
    local t = string.explode(param, ",")
    local item = items[t[1]]
    local amount = tonumber(t[2])
 
  -- Checks if we can buy that itemname --
    if item then
        if (amount == nil) or (math.floor(amount) ~= amount) then
            doPlayerSendCancel(cid, 'Please specify a valid amount.')
            return doSendMagicEffect(getPlayerPosition (cid), CONST_ME_POFF)   
        end

        local limit = math.max(0, getPlayerStorageValue(cid, item.limit))
        if limit >= 3000 then
            doPlayerSendCancel(cid, 'You have reached the limit of charges that you can buy for this potion.')
            return doSendMagicEffect(getPlayerPosition (cid), CONST_ME_POFF)   
        end

        if (limit + amount) > 3000 then
            doPlayerSendCancel(cid, 'You cannot buy more than 3000 charges for this potion.')
            return doSendMagicEffect(getPlayerPosition (cid), CONST_ME_POFF)   
        end

        -- Checks if the player has enough money --
        if doPlayerRemoveMoney(cid, item.cost*amount) == LUA_NO_ERROR then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You have bought '..amount..' '..t[1]..' charges for '..(item.cost*amount)..' golden pieces.')
            setPlayerStorageValue(cid, item.storage, getPlayerStorageValue(cid, item.storage)+amount)
            setPlayerStorageValue(cid, item.limit, limit + 1)
        else
            doPlayerSendCancel(cid, 'You dont have enough money to buy that many charges.')
            doSendMagicEffect(getPlayerPosition (cid), CONST_ME_POFF)   
        end
    else           
        -- Sends the player a message wich includes items he can buy --
        text = "Charges you can buy:\n"
        -- Getting the all itemnames and prics --
        for item1 in pairs (items) do   
            -- Sends a message with each itemname and price --
            text = text .. "\n" .. item1
        end
        text = text .. "\n\nexample: type '!charges gmp,100' para comprar 100 gmp."
        doPlayerPopupFYI(cid, text)
    end
    return true
end

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.

 

¿Quién está en línea?

En total hay 0 usuarios en línea: 0 Registrados, 0 Ocultos y 0 Invitado :: 1 Motor de búsqueda

Usuarios navegando en este foro: Ninguno
Motores de búsqueda : bing

Forum Statistics

Nuestros miembros han públicado un total de posts en temas.
Actualmente hay miembros registrados.
Démosle la bienvenida al miembro más reciente,
La mayor cantidad de usuarios en línea ha sido de .