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

My fragreward doesnt work

Aako

New Member
Joined
May 5, 2011
Messages
32
Reaction score
1
Hi guys, and I have this little problem that I cant fix, it say: you have punished for killing... bla bla bla, thats ok BUT it doesnt giveme the 1 platinum coin any suggestion?

PHP:
function onKill(cid, target, lastHit)
local reward = {
        item = 2152, --ITEM ID!
        count = 1 -- How many?
}
        if(isPlayer(cid) and isPlayer(target)) 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
 
Hi guys, and I have this little problem that I cant fix, it say: you have punished for killing... bla bla bla, thats ok BUT it doesnt giveme the 1 platinum coin any suggestion?

PHP:
function onKill(cid, target, lastHit)
local reward = {
        item = 2152, --ITEM ID!
        count = 1 -- How many?
}
        if(isPlayer(cid) and isPlayer(target)) 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

The "reward" table has to be put before declaring the function (before onKill).
 
Here is one that I made with some extra features you may find interesting.

Lua:
function onKill(cid, t)
	if(isPlayer(cid) and isPlayer(t)) then
		if(getPlayerIp(cid) ~= getPlayerIp(t)) then
			local first = function()
				local v = doCreateItemEx(2152, 1)
				if doPlayerAddItemEx(cid, v, true) ~= RETURNVALUE_NOERROR then
					return false
				end
			
				doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_YELLOW)
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You have been awarded for killing " .. getCreatureName(t))
			end
			
			if first then
				local x = doCreateItemEx(2598, 1)
				if doPlayerAddItemEx(cid, x, true) ~= RETURNVALUE_NOERROR then
					return false
				end
			
				setItemName(x, "Certificate of Death")
				doItemSetText(x, "Certificate of Death: " .. getCreatureName(t) .. " \n\n Congratulations " .. getCreatureName(cid) .. "! You have successfully killed " .. getCreatureName(t))
			end
		else
			doPlayerAddExperience(cid, - 1000000)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have been punished for killing a person with the same IP!")
		end
	end
	
	return true
end

If you have any problems or questions, feel free to private message me.

J.Dre
 
Last edited:
Back
Top