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

Solved Talkaction error in console

azzkaban

Monster Maker
Joined
Feb 23, 2010
Messages
1,101
Reaction score
195
Location
Iquique Chile
I have this error in console:
Code:
[22/5/2013 10:58:32] [Error - Test Interface] 
[22/5/2013 10:58:32] mods/scripts/Scripts en General/Azzkaban Talkactions Respaldo/Gods/SOS Kit.lua
[22/5/2013 10:58:32] Description: 
[22/5/2013 10:58:32] (LuaInterface::luaDoPlayerAddItem) Player not found

[22/5/2013 10:58:32] [Error - TalkAction Interface] 
[22/5/2013 10:58:32] mods/scripts/Scripts en General/Azzkaban Talkactions Respaldo/Gods/SOS Kit.lua
[22/5/2013 10:58:32] Description: 
[22/5/2013 10:58:32] (LuaInterface::luaDoPlayerAddItem) Player not found
[22/5/2013 10:58:32]  (done).

This is talkaction script:

LUA:
--[[Script by: TopMaster]]--
 
local reward = {
{item = 2120, count = 1}, -- Rope
{item = 5710, count = 1}, -- Light Shovel
{item = 2553, count = 1}, -- Pick
{item = 2420, count = 1}} -- Machete
 
local PRICE = 600 -- Coloque o valor em gps nesse caso puis 600gps.
local bag = doPlayerAddItem(cid, 5927, 1) 
 
function onSay(cid, words, param)
   if doPlayerRemoveMoney(cid, PRICE) then
      for _, x in pairs(reward) do
         doAddContainerItem(bag, x.item, x.count)
      end
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Here's your first aid kit")
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
   else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you don't have money!")
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   end
   return true
end
 
bag has to be put inside the function onSay scope.

LUA:
--[[Script by: TopMaster]]--
 
local reward = {
{item = 2120, count = 1}, -- Rope
{item = 5710, count = 1}, -- Light Shovel
{item = 2553, count = 1}, -- Pick
{item = 2420, count = 1}} -- Machete
 
local PRICE = 600 -- Coloque o valor em gps nesse caso puis 600gps.
 
function onSay(cid, words, param)
local bag = doPlayerAddItem(cid, 5927, 1) 

   if doPlayerRemoveMoney(cid, PRICE) then
      for _, x in pairs(reward) do
         doAddContainerItem(bag, x.item, x.count)
      end
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Here's your first aid kit")
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
   else
      doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, you don't have money!")
      doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
   end
   return true
end
 
Cant you skipt to use the variable bag and just use doPlayerAddItem in the for statement?

EDIT: Ok I was to slow. and wrong ^^

You cannot do this, this will create a bag for each item, rather than having 1 bag with everything.
 
Back
Top