• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

8.54 three little things

V0rTeX

New Member
Joined
Feb 7, 2018
Messages
31
Reaction score
2
At the start. Sorry for my bad english
I need something like PlayerSendCancel "You need 100 level":
Lua:
function onUse(cid, item, frompos, item2, topos)
local storage = 90022 -- Make sure to select non-used storage.
local cooldown = 5 -- in seconds.
local level = 100
if getPlayerStorageValue(cid, storage) <= os.time() then
setPlayerStorageValue(cid, storage, os.time() + cooldown)
if getPlayerSkill(cid,0) >= 50 then
if item.uid == 10122 and getPlayerLevel(cid) >= level then
local tekst = "You are teleported."
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE , tekst)
pos = {x=1025, y=1154, z=10}
doTeleportThing(cid, pos)
doSendMagicEffect(pos, 32)
else
return 0
end
else
doPlayerSendTextMessage(cid, 22, "Sorry, you need 50 Strength")
doSendMagicEffect(getPlayerPosition(cid),2)
end
else
doPlayerSendCancel(cid, "Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. getPlayerStorageValue(cid, storage) - os.time())
doSendMagicEffect(getPlayerPosition(cid),2)
end
return 1
end

and the next one :
if dont have local level=200
or
if getPlayerSkill(cid,0) >= 70
dont exchaust this item


Lua:
local scroll = 11585
local temple = {x=1022, y=1023, z=7}
local level = 200

function onUse(cid, item, frompos, item2, topos)
   local storage = 90010 -- Make sure to select non-used storage.
    local cooldown = 3600 -- in seconds.
    if getPlayerStorageValue(cid, storage) <= os.time() then
       setPlayerStorageValue(cid, storage, os.time() + cooldown)
   if getPlayerSkill(cid,0) >= 70 then
   if item.itemid == scroll and getPlayerLevel(cid) >= level then
       doTeleportThing(cid, temple, TRUE)
       doSendMagicEffect(temple,3)
       doSendAnimatedText(temple, "Temple!", 12)
      return 0
end
   else
       doPlayerSendCancel(cid, "Sorry, you need 200lvl and 70 Strength")
       doSendMagicEffect(getPlayerPosition(cid),2)
end
        else
   doPlayerSendCancel(cid, "Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. getPlayerStorageValue(cid, storage) - os.time())
       doSendMagicEffect(getPlayerPosition(cid),2)
      end
return 1
end
Edit:
I need help!
Why items and food dont regeneration mana and hp in pz ? i have to change it but dont know how
 
Last edited:
@gudan garam
can you help me with that ?
i found this:
C++:
bool ConditionRegeneration::executeCondition(Creature* creature, int32_t interval)
{
    internalHealthTicks += interval;
    internalManaTicks += interval;
    if(creature->getZone() != ZONE_PROTECTION)
    {
        if(internalHealthTicks >= healthTicks)
        {
            internalHealthTicks = 0;
            creature->changeHealth(healthGain);
        }


        if(internalManaTicks >= manaTicks)
        {
            internalManaTicks = 0;
            creature->changeMana(manaGain);
        }
    }


    return ConditionGeneric::executeCondition(creature, interval);
}
 
@gudan garam
can you help me with that ?
i found this:
C++:
bool ConditionRegeneration::executeCondition(Creature* creature, int32_t interval)
{
    internalHealthTicks += interval;
    internalManaTicks += interval;
    if(creature->getZone() != ZONE_PROTECTION)
    {
        if(internalHealthTicks >= healthTicks)
        {
            internalHealthTicks = 0;
            creature->changeHealth(healthGain);
        }


        if(internalManaTicks >= manaTicks)
        {
            internalManaTicks = 0;
            creature->changeMana(manaGain);
        }
    }


    return ConditionGeneric::executeCondition(creature, interval);
}

If you can read the code, there is a part that reads:
C++:
if(creature->getZone() != ZONE_PROTECTION)
Translated from c++ to english: "if we get the creatures zone, and its not ZONE_PROTECTION (!= means different, == means equal to) then we execute the code, otherwise we don't need to bother".

ZONE_PROTECTION means protection zone.

The code should look like this for regeneration to work inside protection zones:
C++:
bool ConditionRegeneration::executeCondition(Creature* creature, int32_t interval)
{
    internalHealthTicks += interval;
    internalManaTicks += interval;
 
    if(internalHealthTicks >= healthTicks)
    {
        internalHealthTicks = 0;
        creature->changeHealth(healthGain);
    }


    if(internalManaTicks >= manaTicks)
    {
        internalManaTicks = 0;
        creature->changeMana(manaGain);
    }


    return ConditionGeneric::executeCondition(creature, interval);
}
 
@Vulcan_
At the start. Sorry for my bad english
I need something like PlayerSendCancel "You need 100 level":
Lua:
function onUse(cid, item, frompos, item2, topos)
local storage = 90022 -- Make sure to select non-used storage.
local cooldown = 5 -- in seconds.
local level = 100
if getPlayerStorageValue(cid, storage) <= os.time() then
setPlayerStorageValue(cid, storage, os.time() + cooldown)
if getPlayerSkill(cid,0) >= 50 then
if item.uid == 10122 and getPlayerLevel(cid) >= level then
local tekst = "You are teleported."
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE , tekst)
pos = {x=1025, y=1154, z=10}
doTeleportThing(cid, pos)
doSendMagicEffect(pos, 32)
else
return 0
end
else
doPlayerSendTextMessage(cid, 22, "Sorry, you need 50 Strength")
doSendMagicEffect(getPlayerPosition(cid),2)
end
else
doPlayerSendCancel(cid, "Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. getPlayerStorageValue(cid, storage) - os.time())
doSendMagicEffect(getPlayerPosition(cid),2)
end
return 1
end

and the next one :
if dont have local level=200
or
if getPlayerSkill(cid,0) >= 70
dont exchaust this item


Lua:
local scroll = 11585
local temple = {x=1022, y=1023, z=7}
local level = 200

function onUse(cid, item, frompos, item2, topos)
   local storage = 90010 -- Make sure to select non-used storage.
    local cooldown = 3600 -- in seconds.
    if getPlayerStorageValue(cid, storage) <= os.time() then
       setPlayerStorageValue(cid, storage, os.time() + cooldown)
   if getPlayerSkill(cid,0) >= 70 then
   if item.itemid == scroll and getPlayerLevel(cid) >= level then
       doTeleportThing(cid, temple, TRUE)
       doSendMagicEffect(temple,3)
       doSendAnimatedText(temple, "Temple!", 12)
      return 0
end
   else
       doPlayerSendCancel(cid, "Sorry, you need 200lvl and 70 Strength")
       doSendMagicEffect(getPlayerPosition(cid),2)
end
        else
   doPlayerSendCancel(cid, "Can only be executed once every " .. cooldown .. " seconds. Remaining cooldown: " .. getPlayerStorageValue(cid, storage) - os.time())
       doSendMagicEffect(getPlayerPosition(cid),2)
      end
return 1
end
 

Similar threads

Back
Top