• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Help fix this reward script

piraton

New Member
Joined
Jun 3, 2009
Messages
22
Reaction score
0
I have this error in console:
[15/07/2012 09:00:07] [Error - MoveEvents Interface]
[15/07/2012 09:00:08] data/movements/scripts/Zero/rewards.lua:onStepIn
[15/07/2012 09:00:08] Description:
[15/07/2012 09:00:08] data/movements/scripts/Zero/rewards.lua:7: attempt to compare number with boolean
[15/07/2012 09:00:08] stack traceback:
[15/07/2012 09:00:08] data/movements/scripts/Zero/rewards.lua:7: in function <data/movements/scripts/Zero/rewards.lua:2>

[15/07/2012 09:00:18] [Error - MoveEvents Interface]
[15/07/2012 09:00:19] data/movements/scripts/Zero/rewards.lua:onStepIn
[15/07/2012 09:00:19] Description:
[15/07/2012 09:00:19] (internalGetPlayerInfo) Player not found when requesting player info #10

this is my script:
rewards.lua
Code:
local rewards = {10571, 2307, 2270, 2272, 2263, 9969, 9955, 9956, 11115, 10521, 10558, 2640, 7708, 11221}
function onStepIn(cid, item, position, fromPosition)
	local pos=item.actionid-8002
	local item=rewards[pos]
	local itemWeight = getItemWeightById(item, 1)
	local playerCap = getPlayerFreeCap(cid)
	if playerCap >= itemWeight then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Elegiste: ' .. getItemNameById(item) .. '.')
		doPlayerAddItem(cid, item, 1)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Elegiste: ' .. getItemNameById(item) .. ' pero pesa ' .. itemWeight .. ' oz necesitas mas cap.')
		doTeleportThing(cid, {x=1008, y=1175, z=6}, TRUE)
	end

	return true
end

movements.xml
Code:
	<movevent type="StepIn" event="script" actionid="8003" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8004" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8005" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8006" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8007" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8008" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8009" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8010" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8011" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8012" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8013" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8014" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8015" value="Zero/rewards.lua"/>
	<movevent type="StepIn" event="script" actionid="8016" value="Zero/rewards.lua"/>

could help me please?
 
I don't exactly understand your scripts or what your trying to do but here
LUA:
local rewards = {[1] = 10571, [2] = 2307, [3] = 2270, [4] = 2272, [5] = 2263, [6] = 9969, [7] = 9955, [8] = 9956, [9] = 11115, [10] = 10521, [11] = 10558, [12] = 2640, [13] = 7708, [14] = 11211}

function onStepIn(cid, item, position, fromPosition)
	local items = rewards[1, 14]
	if (getPlayerFreeCap(cid) >= getItemWeight(items, 1)) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Elegiste: ' .. getItemNameById(items) .. '.')
		doPlayerAddItem(cid, items, 1)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Elegiste: ' .. getItemNameById(items) .. ' pero pesa ' .. getITemWeight(items) .. ' oz necesitas mas cap.')
		doTeleportThing(cid, {x=1008, y=1175, z=6}, TRUE)
	end
	return true
end
 
Back
Top