• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Help to check if player is huting

maikons

Member
Joined
Aug 1, 2015
Messages
227
Reaction score
17
Someone can help me to a system? I need check if player is hunting (gain exp)
I tryng to make a system to ADD stamina if players training around map (i dont have training monks, just player sumoning monks)

I want online and no hunting = add stamina

Someone know help me?

my base 0.4:

<globalevent name="addstamina" interval="180000" event="script" value="addstamina.lua"/>

Code:
function onThink(interval, lastExecution)
  for _, pid in ipairs(getPlayersOnline()) do
  doPlayerAddStamina(pid, 1)
  end
  return true
end
 
Code:
function onStatsChange(cid, attacker, type, combat, value)
local monsters_add_stamina = {'Training Monk'} -- monsters that add stamina
local time_between_stamina = 5 -- 5 seconds cooldown to get each stamina, 0 for no CD
   if isPlayer(attacker) and isMonster(cid) then
     if value > 0 then
       for i = 1,#monsters_add_stamina do
         if string.lower(getCreatureName(cid)) == string.lower(monsters_add_stmina[i]) and (not exhaustion.check(attacker, 56701) then
           doPlayerAddStamina(attacker, 1)
           exhaustion.set(attacker,56701,time_between_stamina)
         end
       end
     end
   end
   return true
end
Maybe this?
 
Code:
function onStatsChange(cid, attacker, type, combat, value)
local monsters_add_stamina = {'Training Monk'} -- monsters that add stamina
local time_between_stamina = 5 -- 5 seconds cooldown to get each stamina, 0 for no CD
   if isPlayer(attacker) and isMonster(cid) then
     if value > 0 then
       for i = 1,#monsters_add_stamina do
         if string.lower(getCreatureName(cid)) == string.lower(monsters_add_stmina[i]) and (not exhaustion.check(attacker, 56701) then
           doPlayerAddStamina(attacker, 1)
           exhaustion.set(attacker,56701,time_between_stamina)
         end
       end
     end
   end
   return true
end
Maybe this?

Amazing script, ty
 
Back
Top