Ir para conteúdo

Featured Replies

Postado
[PEDIDO] Matar um player e ganhar XP e Dinheiro.
----------------------------------------------------
 
Tipo Do Script: CreatureScript
 
Versão Utilizada: 8.60
 
Servidor Utilizado: tfs 0.3.6
 
Nível De Experiência: Intermediário
 
----------------------------------------------------
 
Eai galera!
Andei procurando aqui no forum e não encontrei o script desejado.
Eu gostaria de um script "OnKill" pra um servidor de WAR que funcionasse da seguinte forma: 
 
Matar pessoa de lvl menor: 500k de exp  e  5k (dinheiro)
Matar pessoa do mesmo lvl: 1kk de exp  e  10k
Matar pessoa de lvl maior: 2kk de exp  e  20k
 
(De preferência que funcione com MC pra min poder fazer os testes).
 
Logo abaixo segue o meu login.lua, onkill.lua, e creaturescript.xml
 
login.lua
 

local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
 
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
end
 
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
 
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
 
     registerCreatureEvent(cid, "kill")
     registerCreatureEvent(cid, "onPrepareDeath")
     registerCreatureEvent(cid, "PlayerLogout")
     registerCreatureEvent(cid, "Reward")
     registerCreatureEvent(cid, "onPrepareDeath")
registerCreatureEvent(cid, "BroadDeath")
 
registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
 
registerCreatureEvent(cid, "ReportBug")
return true
end

 
onkill.lua
 

  function onKill(cid, target)
--config----------------------------
local lvl = getPlayerLevel(cid) --players level
local nlvl = getPlayerLevel(cid) + 5 -- add 5 levels
--end-------------------------------
    if isPlayer(target) == TRUE then
        if getPlayerIp(cid) ~= getPlayerIp(target) then
                        local exp = (50 * (lvl) * (lvl) * (lvl) - 150 * (lvl) * (lvl) + 400 * (lvl)) / 5
                        local nexp = (50 * (nlvl) * (nlvl) * (nlvl) - 150 * (nlvl) * (nlvl) + 400 * (nlvl)) / 5
                        local newexp = nexp - exp
                        doPlayerAddExp(cid,newexp)
                        doSendAnimatedText(getPlayerPosition(cid), "Orgasmic~", 198)
                else
            doPlayerAddExperience(cid, -50000)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.")
        end
        end
    return TRUE
end 

 
creaturescripts.xml
 

<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="login" name="FirstItems" event="script" value="firstitems.lua"/>
<event type="login" name="StartSkills" event="script" value="startskills.lua"/>
<event type="login" name="Lowlevellock" event="script" value="lowlevellock.lua"/>
<event type="kill" name="FragReward" event="script" value="onkill.lua"/>
<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
<event type="login" name="AntiMC" event="script" value="antimc.lua"/>
<event type="death" name="BroadDeath" event="script" value="deathcast.lua"/>
</creaturescripts>

Editado por bhelliip (veja o histórico de edições)

Resolvido por MaTTch

Ir para solução
  • Respostas 18
  • Visualizações 6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Vai no onlogin.lua e coloca isso junto dos outros: registerCreatureEvent(cid, "FragReward")

  • local config = { --{exp, item, quantidade} {500000, 2152, 50}, -- menor {1000000, 2160, 1}, -- mesmo {2000000, 2160, 2}, -- maior } function onKill(cid, target) if isPlayer(cid) and isPlayer(targ

  • Você registrou no onlogin?

Postado

Te aconselho que seja ondeath.... Pq? Onkill só da premio oro que deu lasthit... Ondeath pra todos que atacaram... Não tô em casa se ninguém te ajudar ajudo quando chegar....

Postado
local config = {
--{exp, item, quantidade}
	{500000, 2152, 50}, -- menor
	{1000000, 2160, 1}, -- mesmo
	{2000000, 2160, 2}, -- maior
}

function onKill(cid, target)
	if isPlayer(cid) and isPlayer(target) then
		if getPlayerLevel(target) < getPlayerLevel(cid) then
			doPlayerAddItem(cid, config[1][2], config[1][3])
			doPlayerAddExp(cid, config[1][1])
			
		elseif getPlayerLevel(target) == getPlayerLevel(cid) then
			doPlayerAddItem(cid, config[2][2], config[2][3])
			doPlayerAddExp(cid, config[2][1])
			
		elseif getPlayerLevel(target) > getPlayerLevel(cid) then
			doPlayerAddItem(cid, config[3][2], config[3][3])
			doPlayerAddExp(cid, config[3][1])
		end
	end
	return true
end

Editado por MaTTch (veja o histórico de edições)

Postado
  • Autor
local config = {
--{exp, item, quantidade}
	{500000, 2152, 50}, -- menor
	{1000000, 2160, 1}, -- mesmo
	{2000000, 2160, 2}, -- maior
}

function onKill(cid, target)
	if isPlayer(cid) and isPlayer(target) then
		if getPlayerLevel(target) < getPlayerLevel(cid) then
			doPlayerAddItem(cid, config[1][2], config[1][3]
			doPlayerAddExp(cid, config[1][1])
			
		elseif getPlayerLevel(target) == getPlayerLevel(cid) then
			doPlayerAddItem(cid, config[2][2], config[2][3]
			doPlayerAddExp(cid, config[2][1])
			
		elseif getPlayerLevel(target) > getPlayerLevel(cid) then
			doPlayerAddItem(cid, config[3][2], config[3][3]
			doPlayerAddExp(cid, config[3][1])
		end
	end
	return true
end

Adicionei o script ao onkill.lua está correto? Se for isso mesmo, ocorreu o seguinte erro no distro: 

 

 

[12/06/2014 22:28:53] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/onkill.lua:12: ')' expected (to close '(' at line 11) near 'doPlayerAddExp'
[12/06/2014 22:28:53] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/onkill.lua)
[12/06/2014 22:28:53] data/creaturescripts/scripts/onkill.lua:12: ')' expected (to close '(' at line 11) near 'doPlayerAddExp'

Editado por bhelliip (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo