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

Looking for Bounty npc TFS 1.2

OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
Joined
Sep 3, 2011
Messages
3,738
Best answers
22
Reaction score
2,427
Location
Sweden
Here you got a script for TFS 1.X, which got both bounty list and commands, but it is a talkaction, should be pretty easy to swap to a NPC instead.
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Here you got a script for TFS 1.X, which got both bounty list and commands, but it is a talkaction, should be pretty easy to swap to a NPC instead.
Where library goes in? Creaturescript? And if i want it to be in npc this entire script should be converted in npc style?
Lua:
function onBountyHunterSay(player, words, param)
    if player:getLevel() < config.minLevelToAddBounty then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] You need level ' .. config.minLevelToAddBounty .. ' to use this command.')
        return false
    end
    local t = param:split(",")
    local name = t[1]
    local currencyType = t[2] and trimString(t[2]) or nil
    local amount = t[3] and tonumber(t[3]) or nil
 
    if not (name and currencyType and amount) then
        local item = ItemType(customCurrency)
        local text = '[BOUNTY HUNTER SYSTEM GUIDE]\n\nCommand Usage:\n!hunt playerName, type(gold/' .. customCurrency .. '/points), amount' .. '\n\n' .. 'Hunting for Gold:\n' .. '--> !hunt Joe,gold,150000\n' .. '--> Placed a bounty on Joe for the amount of 150,000 gps.' .. '\n\n' .. 'Hunting for Premium Points:\n' .. '--> !hunt Joe,points,100\n' .. '--> Placed a bounty on Joe for the amount of 100 premium points.'
        text = text .. (item:getId() > 0 and ('\n\n' .. 'Hunting for ' .. item:getPluralName() .. ':\n' .. '--> !hunt Joe,' .. customCurrency .. ',50\n' .. '--> Placed a bounty on Joe for the amount of 50 ' .. item:getPluralName()) or '')
        player:popupFYI(text)
        return false
    end
 
    local target = Player(name)
    if not target then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] A player with the name of ' .. name .. ' is not online.')
    return false
    end

    if target:getGuid() == player:getGuid() then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] You may not place a bounty on yourself!')
    return false
    end
 
    if config.ipCheck and target:getIp() == player:getIp() then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] You may not place a bounty on a player from the same IP Address!')
    return false
    end
 
    if target:getLevel() < config.minLevelToBeTargeted then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] You may only target players level ' .. config.minLevelToBeTargeted .. ' and above!')
    return false
    end 
 
    local info = target:getBountyInfo()
    if info[1] then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "[BOUNTY HUNTER SYSTEM] This player has already been hunted.")
        return false
    end
 
    local typ = config.currencies[currencyType]
    if not typ then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] The currency type "' .. currencyType .. '" is not a valid bounty currency. [Currencies: gold/points' .. (customCurrency ~= '' and '/'..customCurrency..'' or '') .. ']')
    return false
    end
 
    local minA, maxA = typ.minAmount, typ.maxAmount
    if amount < minA or amount > maxA then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] The currency type of "' .. currencyType .. '" allows the amount to be in the range of ' .. minA .. ' --> ' .. maxA .. '.')
    return false
    end     
 
    if not typ.check(player, amount, currencyType) then
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BOUNTY_HUNTER_SYSTEM] You do not have ' .. amount .. ' ' .. currencyType .. '. [Error: Insufficient Funds]')
    return false
    end     
     
    return addBountyHunt(player, target, amount, currencyType)
end
?
 
Joined
Sep 3, 2011
Messages
3,738
Best answers
22
Reaction score
2,427
Location
Sweden
Add library in data/lib/ and create a folder and call it custom or anything you like and define it in the lib.lua
You need to create a NPC and adapt the script with the functions, you can't just convert it into a "npc style" and it will work.
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Add library in data/lib/ and create a folder and call it custom or anything you like and define it in the lib.lua
You need to create a NPC and adapt the script with the functions, you can't just convert it into a "npc style" and it will work.
It doesnt respond maybe because i didnt set a keyword
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
 
function onCreatureAppear(cid)          npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)       npcHandler:onCreatureDisappear(cid)         end
function onCreatureSay(cid, type, msg)      npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()              npcHandler:onThink()          


function creatureSayCallback(cid, type, msg)
    if player:getLevel() < config.minLevelToAddBounty then
        npcHandler:say('You need level ' .. config.minLevelToAddBounty .. ' to use this command.')
        return false
    end
    local t = param:split(",")
    local name = t[1]
    local currencyType = t[2] and trimString(t[2]) or nil
    local amount = t[3] and tonumber(t[3]) or nil
 
    if not (name and currencyType and amount) then
        local item = ItemType(customCurrency)
        local text = '[BOUNTY HUNTER SYSTEM GUIDE]\n\nCommand Usage:\n!hunt playerName, type(gold/' .. customCurrency .. '/points), amount' .. '\n\n' .. 'Hunting for Gold:\n' .. '--> !hunt Joe,gold,150000\n' .. '--> Placed a bounty on Joe for the amount of 150,000 gps.' .. '\n\n' .. 'Hunting for Premium Points:\n' .. '--> !hunt Joe,points,100\n' .. '--> Placed a bounty on Joe for the amount of 100 premium points.'
        text = text .. (item:getId() > 0 and ('\n\n' .. 'Hunting for ' .. item:getPluralName() .. ':\n' .. '--> !hunt Joe,' .. customCurrency .. ',50\n' .. '--> Placed a bounty on Joe for the amount of 50 ' .. item:getPluralName()) or '')
        player:popupFYI(text)
        return false
    end
 
    local target = Player(name)
    if not target then
        npcHandler:say('A player with the name of ' .. name .. ' is not online.')
    return false
    end

    if target:getGuid() == player:getGuid() then
        npcHandler:say('You may not place a bounty on yourself!')
    return false
    end
 
    if config.ipCheck and target:getIp() == player:getIp() then
        npcHandler:say('You may not place a bounty on a player from the same IP Address!')
    return false
    end
 
    if target:getLevel() < config.minLevelToBeTargeted then
        npcHandler:say('You may only target players level ' .. config.minLevelToBeTargeted .. ' and above!')
    return false
    end 
 
    local info = target:getBountyInfo()
    if info[1] then
        npcHandler:say('This player has already been hunted.')
        return false
    end
 
    local typ = config.currencies[currencyType]
    if not typ then
        npcHandler:say('The currency type "' .. currencyType .. '" is not a valid bounty currency. [Currencies: gold/points' .. (customCurrency ~= '' and '/'..customCurrency..'' or '') .. ']')
    return false
    end
 
    local minA, maxA = typ.minAmount, typ.maxAmount
    if amount < minA or amount > maxA then
        npcHandler:say('The currency type of "' .. currencyType .. '" allows the amount to be in the range of ' .. minA .. ' --> ' .. maxA .. '.')
    return false
    end     
 
    if not typ.check(player, amount, currencyType) then
        npcHandler:say('You do not have ' .. amount .. ' ' .. currencyType .. '. [Error: Insufficient Funds]')
    return false
    end     
     
    return addBountyHunt(player, target, amount, currencyType)
end
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
 
Joined
Sep 3, 2011
Messages
3,738
Best answers
22
Reaction score
2,427
Location
Sweden
Yes, that will not work at all.
Add me on Discord and I'll guide you.
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Someone is able to convert that script to a NPC?
 
OP
henkas

henkas

Active Member
Joined
Jul 8, 2015
Messages
731
Best answers
4
Reaction score
34
Still looking
 
Top