Ir para conteúdo
  • 0

Mudar Função deste evento para TFS 1.0


surfnament

Pergunta

Galera

 

Alguem poderia me ajudar com esse script? Este é o Bounty Hunter... Ele esta dando um erro aqui no console e acredito que seja a função target: ....
Alguem me ajuda?

 

Uso TFS 1.0

 

Print do erro

https://uploaddeimagens.com.br/images/000/576/705/full/errobounty.png?1456784671

 

 

 

bh-kill.lua

 

 

function onKill(creature, target)
if not target:isPlayer() then
return true
end
---- BOUNTY HUNTERS START -----
local result_plr = db.storeQuery("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..target:getGuid().." AND `killed` = 0;")
if(result_plr ~= false) then
prize = tonumber(result.getDataInt(result_plr, "prize"))
bid = tonumber(result.getDataInt(result_plr, "id"))
result.free(result_plr)
else
prize = 0
bid = 0
end

if (bid ~= 0 and prize ~= 0 and (not creature:getTile():hasFlag(TILESTATE_PVPZONE))) then
db.query("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..creature:getGuid()..", `kill_time` = " .. os.time() .. " WHERE `id` = "..bid..";")
creature:setBankBalance(creature:getBankBalance() + prize)
creature:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,'[bOUNTY HUNTERS] You killed hunted player, so you gained the reward!')
Game.broadcastMessage("Bounty Hunter Update:\n " .. creature:getName() .. " has killed " .. target:getName() .. " and earned the prize of " .. prize .. " gps!", MESSAGE_EVENT_ADVANCE)
end
---- BOUNTY HUNTERS END -----
return true
end

 

Editado por Prototype
Link para o comentário
Compartilhar em outros sites

8 respostass a esta questão

Posts Recomendados

  • 0

Funcionou! Muuuuito obrigado cara! REP+

Pra quem tiver problema em nao remover gold e nem dar o premio , fique atento que nao pode haver espaço nas virgulas entre [prize] e nick.
Ex correto: !hunt 1,noob

Ex: errado: !hunt 1 , noob

Link para o comentário
Compartilhar em outros sites

  • 0

Poderia me ajudar a por o broadcastMenssage no talkaction também? Para na hora que der o hunted ele mande a msg pro server todo?

 

function onSay(cid, words, param)

if(param == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
return TRUE
end
local t = string.split(param, ",")
if(not t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
return TRUE
end

local sp_id = getPlayerGUIDByName(t[2])
if sp_id == nil then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Esse player nao existe.")
return TRUE
end

local result_plr = db.storeQuery("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..sp_id.." AND `killed` = 0;")
if(result_plr ~= false) then
is = tonumber(result.getDataInt(result_plr, "sp_id"))
result.free(result_plr)
else
is = 0
end
prize = tonumber(t[1])

if(prize == nil or prize < 1) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
return TRUE
end

if(prize >= 100000000000000000000) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Desculpe,numero muito grande!")
return TRUE
end

if is ~= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Este player ja esta hunted, confira em nosso site a lista.")
return TRUE
end

if doPlayerRemoveMoney(cid, prize*1000000) == TRUE then
db.query("INSERT INTO `bounty_hunters` VALUES (NULL,"..getPlayerGUID(cid)..","..sp_id..",0," .. os.time() .. ","..prize..",0,0);")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Hunted adicionado com sucesso!")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [bOUNTY HUNTERS] Você não tem dinheiro!")
end


return 1
end

 

Eu tentei usar:
broadcastMessage("Hunted Update:\n " .. creature:getName() .. " deu hunted em " .. target:getName() .. " e esta pagando por sua cabeça: " .. prize .. " kks!", MESSAGE_EVENT_ADVANCE)

 

porem nao tive sucesso

Link para o comentário
Compartilhar em outros sites

  • 0
  • Diretor

Poderia me ajudar a por o broadcastMenssage no talkaction também? Para na hora que der o hunted ele mande a msg pro server todo?

 

 

 

Eu tentei usar:

broadcastMessage("Hunted Update:\n " .. creature:getName() .. " deu hunted em " .. target:getName() .. " e esta pagando por sua cabeça: " .. prize .. " kks!", MESSAGE_EVENT_ADVANCE)

 

porem nao tive sucesso

 

 

Tente assim:

function onSay(cid, words, param)

    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
        return TRUE
    end
    local t = string.split(param, ",")
    if(not t[2]) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
        return TRUE
    end
 
    local sp_id = getPlayerGUIDByName(t[2])
    if sp_id == nil then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Esse player nao existe.")     
        return TRUE
    end
 
    local result_plr = db.storeQuery("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..sp_id.."  AND `killed` = 0;")
    if(result_plr ~= false) then
        is = tonumber(result.getDataInt(result_plr, "sp_id"))
        result.free(result_plr)
    else
        is = 0
    end
    prize = tonumber(t[1])

    if(prize == nil or prize < 1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
        return TRUE
    end
 
    if(prize >= 100000000000000000000) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Desculpe,numero muito grande!")
        return TRUE
    end

    if is ~= 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Este player ja esta hunted, confira em nosso site a lista.")
        return TRUE
    end

    if doPlayerRemoveMoney(cid, prize*1000000) == TRUE then
        db.query("INSERT INTO `bounty_hunters` VALUES (NULL,"..getPlayerGUID(cid)..","..sp_id..",0," .. os.time() .. ","..prize..",0,0);")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Hunted adicionado com sucesso!")   
		doBroadcastMessage("Hunted Update:\n " .. creature:getName() .. " deu hunted em " .. target:getName() .. " e esta pagando por sua cabeça: " .. prize .. ".")
 else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Você não tem dinheiro!")         
    end
 
 
    return 1
end
Link para o comentário
Compartilhar em outros sites

  • 0

tente assim:

function onSay(cid, words, param)

    if(param == "") then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
        return TRUE
    end
    local t = string.split(param, ",")
    if(not t[2]) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
        return TRUE
    end
 
    local sp_id = getPlayerGUIDByName(t[2])
    if sp_id == nil then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Esse player nao existe.")     
        return TRUE
    end
 
    local result_plr = db.storeQuery("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..sp_id.."  AND `killed` = 0;")
    if(result_plr ~= false) then
        is = tonumber(result.getDataInt(result_plr, "sp_id"))
        result.free(result_plr)
    else
        is = 0
    end
    prize = tonumber(t[1])

    if(prize == nil or prize < 1) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Use: \"!hunted kks,nick\".")
        return TRUE
    end
 
    if(prize >= 100000000000000000000) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Desculpe,numero muito grande!")
        return TRUE
    end

    if is ~= 0 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Este player ja esta hunted, confira em nosso site a lista.")
        return TRUE
    end

    if doPlayerRemoveMoney(cid, prize*1000000) == TRUE then
        db.query("INSERT INTO `bounty_hunters` VALUES (NULL,"..getPlayerGUID(cid)..","..sp_id..",0," .. os.time() .. ","..prize..",0,0);")
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Hunted adicionado com sucesso!")
		for _, pid in pairs(Game.getPlayers()) do
			local player = Player(pid)
			player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("Hunted Update:\n %s deu hunted em %s e esta pagando por sua cabeça: %d kks!", Player(cid):getName(), t[2], prize))
		end
	else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Hunted [BOUNTY HUNTERS] Você não tem dinheiro!")         
    end
 
 
    return 1
end
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...