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

exp when kill

freak15

Professional Hoster
Joined
Dec 31, 2008
Messages
356
Reaction score
2
Location
Sweden
hello i need a script or somthing.. when a player kill a player wich is higher lvl thay should get like 1kk exp not much exp like 30% of a lvl depends on what lvl the one thay kill is.. you know like icechaw>D thankz for now i will give rep!>D
 
data/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent(cid, "expKill")

data/creaturescripts/creaturescripts.xml
Lua:
<event type="kill" name="expKill" value="script.lua"/>

Script
Lua:
local EXP_AMOUNT = 5000
function onKill(cid, target, lastHit)
	if isPlayer(cid) == TRUE then
		if getPlayerLevel(target) > getPlayerLevel(cid) then
			doPlayerAddExperience(cid, EXP_AMOUNT)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed ".. getCreatureName(target) .." who was level ".. getPlayerLevel(target) .." and have been rewarded with ".. EXP_AMOUNT .." experience points.")
		end
	end
        return TRUE
end
 
Last edited:
Here's fix:
Code:
local EXP_AMOUNT = 5000
function onKill(cid, target, lastHit)
	if isPlayer(killer) == TRUE then
		if getPlayerLevel(target) > getPlayerLevel(cid) then
			doPlayerAddExperience(cid, EXP_AMOUNT)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed ".. getCreatureName(target) .." who was level ".. getPlayerLevel(target) .." and have been rewarded with ".. EXP_AMOUNT .." experience points.")
                end
        end
        return TRUE
end
 
Lua:
local EXP_AMOUNT = 5000
function onKill(cid, target, lastHit)
	if isPlayer(cid) == TRUE and isPlayer(target) == TRUE then
		if getPlayerLevel(target) > getPlayerLevel(cid) then
			doPlayerAddExperience(cid, EXP_AMOUNT)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_GIFT_WRAPS)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have killed ".. getCreatureName(target) .." who was level ".. getPlayerLevel(target) .." and have been rewarded with ".. EXP_AMOUNT .." experience points.")
                end
        end
        return TRUE
end

Shouldn't it be like that?
 
Back
Top Bottom