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

[HELP] !buyaddon script.

Toitsss

New Member
Joined
Sep 15, 2008
Messages
47
Reaction score
0
Hello, trying to improve my server with a !buyaddon command, but apparently it does not work.
buyaddon.lua
Code:
-- Buy Addon command by GLupEK -- 
function onSay(cid, words, param)

local nazwy = {{'citizen'}, {'hunter'}, {'mage'}, {'noblewoman', 'nobleman'}, {'summoner'}, {'warrior'}, {'barbarian'}, {'knight'}, {'assassin'}, {'wizard'}, {'oriental'}, {'pirate'}, {'beggar'}, {'norseman'}, {'warmaster'}, {'demonhunter'}, {yalaharian}}
local outfit = {{136, 128}, {137, 129}, {138, 130}, {140, 132}, {141, 133}, {142, 134}, {143, 147}, {139, 131}, {156, 152}, {149, 145}, {150, 146}, {155, 151}, {153, 157}, {252, 251}, {336, 335}, {229, 228}, {325, 324}}
local availability = {{1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2}, {1,2}}
local cost = {{5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}, {5000, 5000}} -- ceny addonow({addon_1, addon_2})
 if param ~= "!buyaddon" then
  local param_info = string.find(param,",")
  local addon_name = string.sub(param,1,param_info-1)
  local addon_number = string.sub(param,param_info+1,string.len(param))
  for i=1, #nazwy do
   for xd=1, 2 do
    if(addon_name~=nazwy[i][xd])then
    doPlayerSendCancel(cid,'This Addon does not exist.')
    else
    if(addon_number==availability[i][xd])then
     if(doPlayerRemoveMoney(cid, cost[i][addon_number]))then
      for add = 1, 2 do
      doPlayerAddAddon(cid, outfit[i][add], addon_number)
      doPlayerSendCancel(cid,'You\'re successfuly bought addon.')
      end
     else
     doPlayerSendCancel(cid, 'You don\'t have enough money for this addon.')
    end
    else
    doPlayerSendCancel(cid, 'This Addon does not exist.')
   end
  end
 end
end
end
end

buyaddon.xml
Code:
	<talkaction words="!buyaddon" script="buyaddon.lua" />


and the error it gives
Code:
[08/03/2010 17:53:46] [Error - TalkAction Interface] 
[08/03/2010 17:53:46] data/talkactions/scripts/buyaddon.lua:onSay
[08/03/2010 17:53:46] Description: 
[08/03/2010 17:53:46] data/talkactions/scripts/buyaddon.lua:10: attempt to perform arithmetic on local 'param_info' (a nil value)
[08/03/2010 17:53:46] stack traceback:
[08/03/2010 17:53:46] 	data/talkactions/scripts/buyaddon.lua:10: in function <data/talkactions/scripts/buyaddon.lua:2>

[08/03/2010 17:53:47] [Error - TalkAction Interface] 
[08/03/2010 17:53:47] data/talkactions/scripts/buyaddon.lua:onSay
[08/03/2010 17:53:47] Description: 
[08/03/2010 17:53:47] data/talkactions/scripts/buyaddon.lua:10: attempt to perform arithmetic on local 'param_info' (a nil value)
[08/03/2010 17:53:47] stack traceback:
[08/03/2010 17:53:47] 	data/talkactions/scripts/buyaddon.lua:10: in function <data/talkactions/scripts/buyaddon.lua:2>
 
Back
Top