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

Script, parameters was taken from local.

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?
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
Sorry, for bad english.
 
PHP:
 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)
local str = ""
	if(param == '') then
	return true,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Command, param required!") end
                       local x = rewards[param]
                        if not (x) then
                        for name, v in pairs(rewards) do
		        str = str.."\n".. name
	                 end
	               return true,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,str) end
				if(getPlayerItemCount(cid, x.id) < x.amount) then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You don't have " .. x.amount .. " " .. getItemNameById(x.id))
					return true
				end
return TRUE
end
 
Back
Top