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

Lua Frag Reward, Get Trophy for Frags

Trader

New Member
Joined
Aug 12, 2009
Messages
219
Reaction score
2
Hello OTLand,
I am requesting a script when you frag a player, you are automatically given a trophy which says:

You see a golden goblet. It was rewarded for killing (Player Name) at level 100.
I tried looking for some but they never worked for me
So can anyone post a working script and please tell me where and how to register it?

Thank you! Rep+ Of course
 
creaturescripts.xml

Code:
	<event type="kill" name="Trophy" event="script" value="trophy.lua"/>

./data/creaturescripts/scripts

Code:
function onKill(cid, target, damage, flags)
	if(getTileInfo(getCreaturePosition(target)).hardcore == false) then
		if(isPlayer(target) and getPlayerLevel(target) >= 100) then
			local goblet = doPlayerAddItem(cid, 8698, 1)
			doItemSetAttribute(goblet, "description", "It's a trophy you received for killing ".. getCreatureName(target) .." at level ".. getPlayerLevel(target))
		end
	end
	return true
end

Credits: Chojrak

Red
 
Wait... wait...
I did everything there and I don't get anything for killing a player, not working
I don't get any error either, what's wrong?
 
Lua:
function onKill(cid, target, damage, flags)
		if isPlayer(target) == true and isPlayer(cid) == true and getPlayerLevel(target) >= 100 then
			local goblet = doPlayerAddItem(cid, 8698, 1)
			doItemSetAttribute(goblet, "description", "It's a trophy you received for killing ".. getCreatureName(target) .." at level ".. getPlayerLevel(target))
	end
	return true
end
Rep++
 
Use this instead

This do check ip if same ip -1 million exp
Lua:
local reward = {
    item = 2152, --ITEM ID!
    count = 5 -- How many?
}
 
function onKill(cid, target, lastHit)
    if isPlayer(cid) and isPlayer(target) and lastHit then
        if getPlayerIp(cid) ~= getPlayerIp(target) then
            doPlayerAddItem(cid, reward.item, reward.count)
        else
            doPlayerAddExperience(cid, -1000000)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"You have been punished for killing a player of the same IP.")
        end
    end
    return true
end
 
Back
Top Bottom