Ir para conteúdo
  • 0

Hunted sistem por item


Fiapera

Pergunta

Se alguem tiver algum sistema de Hunted System que pode adicionar tanto dinheiro quanto item para recompensa.

Caso não tiver alguém conseguir adaptar para item para mim. Vou deixa os códigos

 

Meu arquivo do talkactions

Spoiler
function onSay(cid, words, param)
if(param == "") then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
 return TRUE
end
local t = string.explode(param, ",")
if(not t[2]) then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
 return TRUE
end
local sp_id = getPlayerGUIDByName(t[2])
if sp_id == nil then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] This player doesn't exists.")  
 return TRUE
end
   local result_plr = db.getResult("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..sp_id.." AND `killed` = 0;")
   if(result_plr:getID() ~= -1) then
 is = tonumber(result_plr:getDataInt("sp_id"))
 result_plr:free()
   else
 is = 0
   end
   prize = tonumber(t[1])
if(prize == nil or prize < 1) then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] Use: \"!hunt [prize],[nick]\" where prize is for example 1(k).")
 return TRUE
end
if(prize >= 100000000000000000000) then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] Sorry, you typed too big number!")
 return TRUE
end
if is ~= 0 then
 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] This player has already hunted.") 
 return TRUE
end
 if doPlayerRemoveMoney(cid, prize*1000) == TRUE then
     db.executeQuery("INSERT INTO `bounty_hunters` VALUES (NULL,"..getPlayerGUID(cid)..","..sp_id..",0," .. os.time() .. ","..prize..",0,0);")
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] Hunt has been added!")   
 else
  doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "[bOUNTY HUNTERS] You haven't got enough money!")   
 end
return 1
end

 

meu Arquivo do creaturescript

Spoiler
function onKill(cid, target)
if isPlayer(target) == TRUE then
pid = cid
pid2 = getPlayerGUID(target)
   local result_plr = db.getResult("SELECT * FROM `bounty_hunters` WHERE `sp_id` = "..pid2.." AND `killed` = 0;")
   if(result_plr:getID() ~= -1) then
   prize = tonumber(result_plr:getDataInt("prize"))
   bid = tonumber(result_plr:getDataInt("id"))
result_plr:free()
   else
   prize = 0
bid = 0
   end
if (bid ~= 0 and prize ~= 0 and not(getTileInfo(getCreaturePosition(cid)).pvp)) then
   db.executeQuery("UPDATE `bounty_hunters` SET `killed` = 1, `k_id`="..getPlayerGUID(cid)..", `kill_time` = " .. os.time() .. " WHERE `id`  = "..bid..";")
doPlayerAddMoney(cid,prize*1000)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,'[bOUNTY HUNTERS] You killed hunted player, so you gained the reward!')
end 
end
return TRUE
end

 

Não sei se vai mudar no query do phpmyadmin, mais caso necessita mexer.

Spoiler
CREATE TABLE IF NOT EXISTS `bounty_hunters` (
 `id` int(11) NOT NULL auto_increment,
 `fp_id` int(11) NOT NULL,
 `sp_id` int(11) NOT NULL,
 `k_id` int(11) NOT NULL,
 `added` int(15) NOT NULL,
 `prize` bigint(20) NOT NULL,
 `killed` int(11) NOT NULL,
 `kill_time` int(15) NOT NULL,
 PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

 

 

Alguem quebra esse galho para mim...

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...