• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Get 2 items instead of 1

Vendeliko

Banned User
Joined
Dec 3, 2011
Messages
3,087
Reaction score
93
Location
Beside that guy with that thing but without that t
Hey guys,anyone could please edit this script so that instead of getting one item as a reward you get two? I tried adding another id beside 6571 but it just gave one item :/ Also if its possible,please make it dont give rewards for players who kill someone with same ip as theirs and make em lose 150hp+mana. Also if player X kills player Y 3x times in a row same happens.

heres the script;
Code:
function onDeath(cid, corpse, deathList)
local reward = {
        item = 6571,
        count = 1

}
	for i = 1, #deathList do
		if isPlayer(cid) and isPlayer(deathList[i]) then
			--[[if getPlayerIp(cid) ~= getPlayerIp(deathList[i]) then	]]--	
				if getPlayerItemCount(deathList[i], reward.item) > 0 then
					local item = getPlayerItemById(deathList[i], true, reward.item)
					if item.type >= ITEMCOUNT_MAX then
						doPlayerAddItem(deathList[i], reward.item, reward.count)
						doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
						doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
					else
						doTransformItem(item.uid, reward.item, item.type + 1)
						doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
						doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
					end
				else
					doPlayerAddItem(deathList[i], reward.item, reward.count)
					doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
					doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
				end
			--[[else
				doPlayerSendTextMessage(deathList[i], 18, "You didn't get frag/reward because of killing a player with same ip.")
				
			end ]]--
		end
	end
	return true
end


Thanks in advance,
Vendeliko.
 
Last edited:
Have you tried this?

Code:
local reward = {
        item = 6571, 5952
        count = 2

That is a very silly attempt; this will definitely not work.

You will need to use a table that is iterated through by using a loop.
lua-users wiki: Tables Tutorial

Alternatively, you can just do what Scarlet said, just add another doPlayerAddItem line.
 
@loney
if im correct,the count 2 will give the player 2x of each item and i do not want that.

@evan & scarlet
I tried what you said and it just gives the first item
heres the script
Code:
function onDeath(cid, corpse, deathList)
local reward = {
        item = 6571, 2160,
        count = 1

}
	for i = 1, #deathList do
		if isPlayer(cid) and isPlayer(deathList[i]) then
			--[[if getPlayerIp(cid) ~= getPlayerIp(deathList[i]) then	]]--	
				if getPlayerItemCount(deathList[i], reward.item) > 0 then
					local item = getPlayerItemById(deathList[i], true, reward.item)
					if item.type >= ITEMCOUNT_MAX then
						doPlayerAddItem(deathList[i],         reward.item, reward.count)
	doPlayerAddItem(deathList[i], reward.item, reward.count)
						doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
						doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
					else
						doTransformItem(item.uid, reward.item, item.type + 1)
						doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
						doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
					end
				else
					doPlayerAddItem(deathList[i], reward.item, reward.count)
		doPlayerAddItem(deathList[i], reward.item, reward.count)
					doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
					doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
				end
			--[[else
				doPlayerSendTextMessage(deathList[i], 18, "You didn't get frag/reward because of killing a player with same ip.")
				
			end ]]--
		end
	end
	return true
end
 
Use this:

LUA:
function onDeath(cid, corpse, deathList)
local reward = {
        item = 6571,
        count = 1,
        item2 = 2160,
        count2 = 1

}
	for i = 1, #deathList do
		if isPlayer(cid) and isPlayer(deathList[i]) then
			--[[if getPlayerIp(cid) ~= getPlayerIp(deathList[i]) then	]]--	
				if getPlayerItemCount(deathList[i], reward.item) > 0 then
					local item = getPlayerItemById(deathList[i], true, reward.item)
					if item.type >= ITEMCOUNT_MAX then
						doPlayerAddItem(deathList[i], reward.item, reward.count)
                                                doPlayerAddItem(deathList[i], reward.item2, reward.count2)
						doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
						doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
					else
						doTransformItem(item.uid, reward.item, item.type + 1)
doPlayerAddItem(deathList[i], reward.item2, reward.count2)
						doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
						doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
					end
				else
					doPlayerAddItem(deathList[i], reward.item, reward.count)
doPlayerAddItem(deathList[i], reward.item2, reward.count2)
					doCreatureSetStorage(deathList[i], 20233, getPlayerStorageValue(deathList[i], 20233)+1)
					doSendAnimatedText(getPlayerPosition(deathList[i]), "Frag!", TEXTCOLOR_RED)
				end
			--[[else
				doPlayerSendTextMessage(deathList[i], 18, "You didn't get frag/reward because of killing a player with same ip.")
				
			end ]]--
		end
	end
	return true
end

It's the easiest way... xDDD

Hope it works... :)
 
Look at the script, its obviously commented out.
Just remove that stuff (--).

At the script before the last one, it doesn't work because you're not using tables.
 
Back
Top