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

Lua Exercise Weapon

bolachapanco

Member
Joined
Aug 5, 2023
Messages
30
Reaction score
5
Location
Brazil
Does anyone have or could create a script that, when purchasing an item and using it, automates the exercise weapon. This means that when you finish charging one exercise weapon, it starts the other automatically.

I'm using a Canary Base but it could also be for TFS 1.3+
 
Does anyone have or could create a script that, when purchasing an item and using it, automates the exercise weapon. This means that when you finish charging one exercise weapon, it starts the other automatically.
I'm using a Canary Base but it could also be for TFS 1.3+

Search for
Lua:
if weapon:getAttribute(ITEM_ATTRIBUTE_CHARGES) <= 0 then
        weapon:remove(1)
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your training weapon has disappeared.")
        LeaveTraining(playerId)
        return false
    end

switch to
Lua:
if weapon:getAttribute(ITEM_ATTRIBUTE_CHARGES) <= 0 then
    weapon:remove(1)
    local weapon = player:getItemById(weaponId, true)
    if not weapon or (not weapon:isItem() or not weapon:hasAttribute(ITEM_ATTRIBUTE_CHARGES)) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your training weapon has disappeared.")
        LeaveTraining(playerId)
        return false
    end
end
 
Back
Top