klekSu
Stroke my ego.
- Joined
- Nov 4, 2008
- Messages
- 1,285
- Reaction score
- 18
Hi there I've got a problem. The script stops at function for, what's wrong with it?
doPlayerSendTextMessage 1 and 2 are for checking where does the script stops, and it displays only "1" so something must be wrong with function for, but what?
Lua:
local items = {
[40001] = {2166, 1, 6527, 200},
[40002] = {5785, 1, 6527, 1000},
[40003] = {2217, 1, 6527, 6000}
}
function onUse(cid, item, frompos, item2, topos)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "1")
for i=1, #items do
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "2")
if(item.actionid == items[i]) and (item.itemid == 1512) then
if(getPlayerItemCount(cid, items[i][3]) <= items[i][4]) then
doPlayerAddItem(cid,items[i][1],items[i][2])
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Here you are.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You don\'t have enough tokens.")
return TRUE
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Wrong aid.")
end
end
return TRUE
end