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

like a reward.lua

Ralfegor

New Member
Joined
Apr 6, 2008
Messages
297
Reaction score
1
example:

if i am lvl 60 and i kill a lvl 62(higher lvl than me, 2 lvls more) then when i kill him doPlayerAddItem(money) how much? if he is to lvl more than me then reward me with 10k, 5k each lvl, if i am 60 and i kill a lvl 63 then reward me with 15k

help me please how to do the
Code:
local money =
 
I dont udnerstand you:eek:

Maybe this?
Lua:
function onPrepareDeath(cid, killer) 
	if isPlayer(killer) == TRUE and getPlayerLevel(killer) > getPlayerLevel(cid) then
		doPlayerAddItem(killer, 2160, 1)
		return TRUE
	end

updated :)
Lua:
function onPrepareDeath(cid, killer) 
local config =
{
addItem = 2160, -- item id
itemCount = 1 -- count.
}
	if isPlayer(killer) == TRUE and getPlayerLevel(killer) > getPlayerLevel(cid) then
		doPlayerAddItem(killer, config.addItem, config.itemCount)
		doPlayerSendTextMessage(killer, 19, "You received a "..getItemName(config.addItem).." for killing "..getPlayerName(cid)..".")
		end
	return TRUE
end
 
Last edited:
i want 5k for each lvl difference, like if i kill a lvl 24 and im lvl 20 the difference is 4, then 4 * 5 = 20 and i gain 20k...., if he is 1 lvl higher than me only then i gain 5k only
 
Last edited:
Maybe this :eek: :)

Lua:
function onPrepareDeath(cid, killer) 
local config =
{
addItem = 2152, -- item id
countPerLevel = 50 -- this means how many platinum coins
}
        if isPlayer(killer) == TRUE and getPlayerLevel(killer) > getPlayerLevel(cid) then
                doPlayerAddItem(killer, config.addItem, getPlayerLevel(cid) - getPlayerLevel(killer) * config.countPerLevel)
                doPlayerSendTextMessage(killer, 19, "You received a "..getItemName(config.addItem).." for killing "..getPlayerName(cid)..".")
                end
        return TRUE
end

edit, updated with doPlayerAddMoney.
Lua:
function onPrepareDeath(cid, killer) 
local config =
{
addItem = 2152, -- item id
countPerLevel = 50 -- this means how many platinum coins
}
        if isPlayer(killer) == TRUE and getPlayerLevel(killer) > getPlayerLevel(cid) then
                doPlayerAddMoney(killer, config.addItem, getPlayerLevel(cid) - getPlayerLevel(killer) * config.countPerLevel)
                doPlayerSendTextMessage(killer, 19, "You received a "..getItemName(config.addItem).." for killing "..getPlayerName(cid)..".")
                end
        return TRUE
end
if not work, try the first one.
end
 
Warning....

You will want to put a minimum requirement on the level. Else you will have someone making a level 12, and a level 8 and killing him/herself just to get a quick 20k. Easily abused. Be warned.

Take care~
 
Sorry Zonet ;d I can't life without rewriting every single script xP

Code:
local config =
{
	moneyPerLevel = 5000,	-- this means how many gold coins for each level
	minLevel = 50		-- prevent noob chars from earning money
}

function onKill(cid, target)
        if(isPlayer(target) ~= TRUE) then
		return TRUE
	end

	local playerLevel = getPlayerLevel(cid), targetLevel = getPlayerLevel(killer)
	if(targetLevel < config.minLevel or playerLevel < config.minLevel or playerLevel < targetLevel) then
		return TRUE
	end

	local money = (playerLevel - targetLevel) * config.moneyPerLevel
	doPlayerAddMoney(cid, money)
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received " .. money .. " gold coins for killing " .. getPlayerName(cid) .. ".")
        return TRUE
end
 
tnx thats what i wanted
Code:
getPlayerLevel(cid) - getPlayerLevel(mostDamageKiller) * 50

thats the
Code:
local money =

i was talking about +rep Zonet :D
 
@slawkens

Lua:
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You received " .. money .. " gold coins for killing " .. getPlayerName(cid) .. ".")

getPlayerName(cid)?, i think is getPlayerName(target)
 
Back
Top