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

TFS 0.4 - Auto Eating Trainers.

Warmen ATS

New Member
Joined
Apr 13, 2018
Messages
4
Reaction score
1
Personally, I have a small question .. I use the script below to regenerate stamina in the trainers. I would have given 2 orders for it.

1 ° The script feed the character automatically, in the topic has a script that does this function .. if you can adapt the two.

2 ° When the player's stamina is full, it says "your stamina is full"


Code:
addSta = {}
local config = {
timeToAdd = 0.1, -- intervalo de tempo para adicionar.
addTime = 1, -- quanto vai adicionar.
}
local function addStamina(cid, check)
    if not isPlayer(cid) then
        addSta[cid] = nil
    return true
    end
  
    if check then return true end
  
    doPlayerSetStamina(cid, getPlayerStamina(cid) + config.addTime)
    doPlayerSendTextMessage(cid, 25, "Você recebeu "..config.addTime.." minutos de stamina.")
    addSta[cid] = addEvent(addStamina, config.timeToAdd * 60 * 1000, cid, false)
end
function onStepIn(cid)
    if isPlayer(cid) then
        addSta[cid] = addEvent(addStamina, config.timeToAdd * 60 * 1000, cid, false)
        doPlayerSendTextMessage(cid, 25, "Você recebeu "..config.addTime.." minutos de stamina.")
    end
return true
end
function onStepOut(cid)
    if isPlayer(cid) then
        stopEvent(addSta[cid])
        addSta[cid] = nil
        addStamina (cid, true)
    end
return true
end



Code:
    if getPlayerFood(uid) < config.food then
        doPlayerFeed(uid, config.food)
        doCreatureSay(uid, "Eating.", TALKTYPE_MONSTER)
 

Similar threads

Back
Top