Ir para conteúdo

Featured Replies

  • Respostas 20
  • Visualizações 866
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • function onKill(cid, target) --config---------------------------- local lvl = getPlayerLevel(cid) --players level local target_lvl = getPlayerLevel(target) -- add 5 levels --end-----------------------

Postado
function onKill(cid, target)
--config----------------------------
local lvl = getPlayerLevel(cid) --players level
local target_lvl = getPlayerLevel(target) -- add 5 levels
--end-------------------------------

    if isPlayer(target) == TRUE then
		if getPlayerIp(cid) ~= getPlayerIp(target) then
			doPlayerAddExperience(cid, -50000)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Voce foi punido por matar alguem do mesmo IP e não ganha lvl")
			return TRUE
		else
		if lvl < target_lvl then -- Quem mata é menor do que de quem morre
			if (lvl - target_lvl) <= 20 then -- Se a diferença for 20 ou menos adiciona 5 level
				doPlayerAddSkill(cid, SKILL__LEVEL, 5)
			end
			if (lvl - target_lvl) <= 50 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 7)
			end
			if (lvl - target_lvl) <= 80 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 9)
			end
			if (lvl - target_lvl) <= 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 11)
			end
			if (lvl - target_lvl) > 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 15) -- Se a diferença for maior que 100 levels adiciona 15 lvl
			end
		end
		if lvl > target_lvl then -- Quem mata é maior do que de quem morre
			if (target_lvl - lvl) <= 20 then -- Se a diferença for 20 ou menos adiciona 5 level
				doPlayerAddSkill(cid, SKILL__LEVEL, 5)
			end
			if (target_lvl - lvl) <= 50 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 4)
			end
			if (target_lvl - lvl) <= 80 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 3)
			end
			if (target_lvl - lvl) <= 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 2)
			end
			if (target_lvl - lvl) > 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 1) -- Se a diferença for maior que 100 levels adiciona 15 lvl
			end	
		end
    end
	doSendAnimatedText(getPlayerPosition(cid), "Orgasmic~", 198)
    return TRUE
end

Não testei, mas creio que ira funcionar. Botei uns comentarios para ti entender, ta bem explicativo creio eu. Testa e me diz.

Postado
  • Autor

Deu esse erro na distro:
 

[20/07/2014 01:42:20] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/onkill.lua:50: 'end' expected (to close 'function' at line 1) near '<eof>'
[20/07/2014 01:42:20] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/onkill.lua)
[20/07/2014 01:42:20] data/creaturescripts/scripts/onkill.lua:50: 'end' expected (to close 'function' at line 1) near '<eof>'
Postado
function onKill(cid, target)
--config----------------------------
local lvl = getPlayerLevel(cid) --players level
local target_lvl = getPlayerLevel(target) -- add 5 levels
--end-------------------------------

    if isPlayer(target) == TRUE then
		if getPlayerIp(cid) ~= getPlayerIp(target) then
			doPlayerAddExperience(cid, -50000)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Voce foi punido por matar alguem do mesmo IP e não ganha lvl")
			return TRUE
		else
		if lvl < target_lvl then -- Quem mata é menor do que de quem morre
			if (lvl - target_lvl) <= 20 then -- Se a diferença for 20 ou menos adiciona 5 level
				doPlayerAddSkill(cid, SKILL__LEVEL, 5)
			end
			if (lvl - target_lvl) <= 50 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 7)
			end
			if (lvl - target_lvl) <= 80 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 9)
			end
			if (lvl - target_lvl) <= 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 11)
			end
			if (lvl - target_lvl) > 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 15) -- Se a diferença for maior que 100 levels adiciona 15 lvl
			end
		end
		if lvl > target_lvl then -- Quem mata é maior do que de quem morre
			if (target_lvl - lvl) <= 20 then -- Se a diferença for 20 ou menos adiciona 5 level
				doPlayerAddSkill(cid, SKILL__LEVEL, 5)
			end
			if (target_lvl - lvl) <= 50 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 4)
			end
			if (target_lvl - lvl) <= 80 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 3)
			end
			if (target_lvl - lvl) <= 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 2)
			end
			if (target_lvl - lvl) > 100 then
				doPlayerAddSkill(cid, SKILL__LEVEL, 1) -- Se a diferença for maior que 100 levels adiciona 15 lvl
			end	
		end
		end
    end
	doSendAnimatedText(getPlayerPosition(cid), "Orgasmic~", 198)
    return TRUE
end

Faltou um end, testa.

Postado
  • Autor

Opa, na distro não deu erro nenhum... Agora vou passar para meu servidor e testar se está de acordo, se estiver tudo certinho posto aqui, beleza? ;) REP+ já pela ajuda...

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.6k

Informação Importante

Confirmação de Termo