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

Solved I need to add EXHAUST!

Ennokas

Member
Joined
Feb 13, 2009
Messages
435
Reaction score
8
Location
unknown
I need 1 second exhaust, so players cant spam potions!

Code:
-- fluids by atolon --
-- fluids fixed by Shampo --

   function onUse(cid, item, frompos, item2, topos)
       -- itemid means that is a creature
if frompos.x == 65535 then
    if item2.itemid == 1 then
           if item.type == 0 then
               doPlayerSendCancel(cid,"To jest puste.")
           else
               if item2.uid == cid then
                   doChangeTypeItem(item.uid,0)
                   if item.type == 2 then
                       doPlayerSay(cid,"it was blood....",16)
                   elseif item.type == 4 then
                       doPlayerSay(cid,"Yuk! slime!!",16)
                                           doSendMagicEffect(topos,8)
                   elseif item.type == 3 then
                       doPlayerSay(cid,"no to chlup w ten glupi dziub!!",16)
                       doPlayerSetDrunk(cid,60*1000)
                   elseif item.type == 5 then
                       doPlayerSay(cid,"it was fresh lemonade!!",16)
                   elseif item.type == 11 then
                       doPlayerSay(cid,"arrgh is oil!!",16)
                   elseif item.type == 15 then
                       doPlayerSay(cid,"hit! hit! dobre winko",16)
                       doPlayerSetDrunk(cid,60*1000)
                   elseif item.type == 6 then
                       doPlayerSay(cid,"oh!, yummy milk!",16)
                   elseif item.type == 10 then
                       doPlayerAddHealth(cid,500)
                                           doSendMagicEffect(topos,12)
                   elseif item.type == 13 then
                       doPlayerSay(cid,"Eww.. urine!",16)
                   elseif item.type == 7 then
                       doPlayerAddMana(cid,1000)
                                           doSendMagicEffect(topos,12)
                       doPlayerSay(cid,"YeAh Banny! ++pkt Many!",16)
                   elseif item.type == 0 then
                       doPlayerSay(cid,"Arrgh its mud!",16)
                   elseif item.type == 26 then
                       doPlayerSay(cid,"HOT!",16)
                                           doSendMagicEffect(topos,6)
                   elseif item.type == 28 then
                       doPlayerSay(cid,"Argh, swamp water!",16)
                                           doSendMagicEffect(topos,8)
                   else
                       doPlayerSay(cid,"Gulp.",1)
                   end
               else
                   splash = doCreateItem(2025,item.type,topos)
                   doChangeTypeItem(item.uid,0)
                   doDecayItem(splash)
               end
           end
   --water--
       elseif (item2.itemid >= 490 and item2.itemid <= 493) or
           (item2.itemid >= 618 and item2.itemid <= 629) then
           doChangeTypeItem(item.uid,1)

   --mud--
       elseif item2.itemid == 103 then
           doChangeTypeItem(item.uid,19)
   --lava--
       elseif (item2.itemid >= 598 and item2.itemid < 712) or item2.itemid == 1509 then
           doChangeTypeItem(item.uid,26)
   --mud--
       elseif (item2.itemid >= 351 and item2.itemid <= 355) then
           doChangeTypeItem(item.uid,19)

   --swamp--
       elseif (item2.itemid >= 602 and item2.itemid <= 605) then
           doChangeTypeItem(item.uid,28)
   --cask--
       elseif item2.itemid == 1771 then
           doChangeTypeItem(item.uid,1)  --water--
       elseif item2.itemid == 1772 then
           doChangeTypeItem(item.uid,3)  --beer--
       elseif item2.itemid == 3941 then
           doChangeTypeItem(item.uid,15) --wine--

   --end cask--

   -- Blood/swamp in decayto corpse --NO FINISH--

       elseif item2.itemid > 3922 and item2.itemid < 4327 then
           doChangeTypeItem(item.uid,2)

   -- End Blood/swamp in decayto corpse --NO FINISH--

       else
           if item.type == 0 then
               doPlayerSendCancel(cid,"To jest puste.")
           else
               splash = doCreateItem(2025,item.type,topos)
               doChangeTypeItem(item.uid,0)
               doDecayItem(splash)
           end
       end
else
doPlayerSendCancel(cid, "Put it inside your inventory first.")
return 1
end

       return 1
   end
 
Not to be rude but.. you seem to need a lot of things.
These forums are not here so we can build your server for you and then you profit from it.
They are here so you can learn, meet us halfway and at least try to make something that is truly your own work.
 
I have made a lot of threads, so people can help me, but nobody helps me. I got some strange server, i did this exhaust yesterday, but only hp porion worked and mana didnt work. I have looked around a lot and i didnt find anything. So i made post here, like always nobody wont help, just replyng some comments and wont help.

Srry for bad english. =)

Code:
function onUse(cid, item, frompos, item2, topos)
local exhausted_seconds = 1 -- How many seconds manarune will be unavailible to use. --
local exhausted_storagevalue = 1259 -- Storage Value to store exhaust. It MUST be unused! --
mag = getPlayerMagLevel(cid)
if mag >= 0 then
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(topos,1)
doPlayerSay(cid,"Ahm! Regeneration, mhm ;*",16)
doPlayerAddMana(cid,"100")
doPlayerAddHealth(cid,"0")
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
if item.type > 7 then

mag = getPlayerMagLevel(cid)
if mag >= 0 then
if(os.time() > getPlayerStorageValue(cid, exhausted_storagevalue)) then
doSendMagicEffect(topos,1)
doPlayerSay(cid,"Ahm! Regeneration, mhm ;*",16)
doPlayerAddMana(cid,"100")
doPlayerAddHealth(cid,"0")
setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + exhausted_seconds)
if item.type > 10 then

end
else
doSendMagicEffect(frompos,2)
doPlayerSendCancel(cid,"Stop!")
end
end
return 1
end

I made this, but it adds error to server and only hp works.
 
Last edited by a moderator:
If you ask for help with problems, always post your server version and client version (you can add download link aswell so people know exactly which server you use and the features of this server).
Atm you have exhaustion with storage, it's possible, but not needed if the exhaustion will only take a few seconds. You can just use an exhaustion condition.

Example for TFS 0.3 versions

Above function onUse
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 1000)

Under function onUse
Code:
if getCreatureCondition(cid, CONDITION_EXHAUST) == TRUE then
     doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
     doPlayerSendCancel(cid, "You are exhausted")
     return TRUE
end

doAddCondition(cid, exhaust)

Looks lke you are using an old server so I already added the == TRUE.
You can look in global.lua for the right constant names (instead of CONDITION_EXHAUST) and if getCreatureCondition is nil you can try hasCondition instead.
 
Thanks, i will look this page. And i gonna test tist script. Its old 7.6 xml server. LoozikOts v5.0 extra. Yea it was copy paste, but i have done all scripts like that ;)
 
I tested, it adds mana when i click on hit and wont add hp, i just need to figure out 1 script what i posted to add exhaust there. Bcz i got 2 potions with same id and 1 is hp and other is mana potion.
 
Where did you downloaded the server? You can look for an other lib lua file with constant names.
Although you can also use storage as exhaustion, what are the problem with that exactly? Do you get errors?
 
You can add this under function onUse
Code:
local exhausted_storagevalue = 1259

if getPlayerStorageValue(cid, exhausted_storagevalue) > os.time() then
     doPlayerSendCancel(cid, "You're exhausted")
     return 1
end

setPlayerStorageValue(cid, exhausted_storagevalue, os.time() + 1)
 
I don't know what you mean by "It works only, if u have mana lower".
If you want to make the exhaustion higher, you can change 1 to for example 2.
 
I added this what u writed here, now potions dont show magic effekt and i can use only potions if my mana or hp is below 100. Over 100, then i cant use :S
Both potions are with same id 2005
 
Last edited:
No im not, i need just help. Here is 1 more thread with same problem, nobody helped him.

I got 2 different potions.
23:26 You see a bucket of manafluid.Id: 2005. Pos: 65535 64 5.
23:26 You see a bucket of lifefluid.Id: 2005. Pos: 65535 64 6.

Mana fluid should give 100 mana and hp fluid should give 100 hp. Not 1 potion give both. I need exhaust in this script :P


Code:
-- fluids by atolon --
-- fluids fixed by Shampo --

   function onUse(cid, item, frompos, item2, topos)
       -- itemid means that is a creature
if frompos.x == 65535 then
    if item2.itemid == 1 then
           if item.type == 0 then
               doPlayerSendCancel(cid,"To jest puste.")
           else
               if item2.uid == cid then
                   doChangeTypeItem(item.uid,0)
                   if item.type == 2 then
                       doPlayerSay(cid,"it was blood....",16)
                   elseif item.type == 4 then
                       doPlayerSay(cid,"Yuk! slime!!",16)
                                           doSendMagicEffect(topos,8)
                   elseif item.type == 3 then
                       doPlayerSay(cid,"no to chlup w ten glupi dziub!!",16)
                       doPlayerSetDrunk(cid,60*1000)
                   elseif item.type == 5 then
                       doPlayerSay(cid,"it was fresh lemonade!!",16)
                   elseif item.type == 11 then
                       doPlayerSay(cid,"arrgh is oil!!",16)
                   elseif item.type == 15 then
                       doPlayerSay(cid,"hit! hit! dobre winko",16)
                       doPlayerSetDrunk(cid,60*1000)
                   elseif item.type == 6 then
                       doPlayerSay(cid,"oh!, yummy milk!",16)
                   elseif item.type == 10 then
                       doPlayerAddHealth(cid,500)
                                           doSendMagicEffect(topos,12)
                   elseif item.type == 13 then
                       doPlayerSay(cid,"Eww.. urine!",16)
                   elseif item.type == 7 then
                       doPlayerAddMana(cid,1000)
                                           doSendMagicEffect(topos,12)
                       doPlayerSay(cid,"YeAh Banny! ++pkt Many!",16)
                   elseif item.type == 0 then
                       doPlayerSay(cid,"Arrgh its mud!",16)
                   elseif item.type == 26 then
                       doPlayerSay(cid,"HOT!",16)
                                           doSendMagicEffect(topos,6)
                   elseif item.type == 28 then
                       doPlayerSay(cid,"Argh, swamp water!",16)
                                           doSendMagicEffect(topos,8)
                   else
                       doPlayerSay(cid,"Gulp.",1)
                   end
               else
                   splash = doCreateItem(2025,item.type,topos)
                   doChangeTypeItem(item.uid,0)
                   doDecayItem(splash)
               end
           end
   --water--
       elseif (item2.itemid >= 490 and item2.itemid <= 493) or
           (item2.itemid >= 618 and item2.itemid <= 629) then
           doChangeTypeItem(item.uid,1)

   --mud--
       elseif item2.itemid == 103 then
           doChangeTypeItem(item.uid,19)
   --lava--
       elseif (item2.itemid >= 598 and item2.itemid < 712) or item2.itemid == 1509 then
           doChangeTypeItem(item.uid,26)
   --mud--
       elseif (item2.itemid >= 351 and item2.itemid <= 355) then
           doChangeTypeItem(item.uid,19)

   --swamp--
       elseif (item2.itemid >= 602 and item2.itemid <= 605) then
           doChangeTypeItem(item.uid,28)
   --cask--
       elseif item2.itemid == 1771 then
           doChangeTypeItem(item.uid,1)  --water--
       elseif item2.itemid == 1772 then
           doChangeTypeItem(item.uid,3)  --beer--
       elseif item2.itemid == 3941 then
           doChangeTypeItem(item.uid,15) --wine--

   --end cask--

   -- Blood/swamp in decayto corpse --NO FINISH--

       elseif item2.itemid > 3922 and item2.itemid < 4327 then
           doChangeTypeItem(item.uid,2)

   -- End Blood/swamp in decayto corpse --NO FINISH--

       else
           if item.type == 0 then
               doPlayerSendCancel(cid,"To jest puste.")
           else
               splash = doCreateItem(2025,item.type,topos)
               doChangeTypeItem(item.uid,0)
               doDecayItem(splash)
           end
       end
else
doPlayerSendCancel(cid, "Put it inside your inventory first.")
return 1
end

       return 1
   end
 
Back
Top