GarQet
Own3d!
- Joined
- Feb 10, 2009
- Messages
- 1,381
- Solutions
- 14
- Reaction score
- 81
How to do that the parameter was taken from local rewards? If we say for example: !reward b, script will work. How do I change the script to become operational?
Sorry, for bad english.
LUA:
local rewards = {
[b] = {id = 5807, amount = 5, items = {2493, 2646}}, -- [name] = {id, amount, gifts}
[s] = {id = 5806, amount = 3, items = {8866, 8890, 2197}},
[g] = {id = 5805, amount = 2, items = {8891, 2474}}
}
function onSay(cid, words, param, channel, frompos, topos)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command, param required!")
else
for name, v in pairs(rewards) do
if(param == 'name') then
if(getPlayerItemCount(cid, v.id) <= v.amount) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You don't have " .. v.amount .. " " .. name .. " items!")
return true
end
end
end
return true
end
end