samuel157
/root
- Joined
- Mar 19, 2010
- Messages
- 518
- Solutions
- 3
- Reaction score
- 71
- Location
- São Paulo, Brazil
- GitHub
- Samuel10M
BUY .LUA
SELL .LUA
validCurrencies = {9971, 2160, 2148, 2152, 2159}, maxPrice = 1000000000
LUA:
--[[ Buy & Sell Talkaction System
Made by Yohan(me). ]]--
function onSay(cid, words, param) -- script by Yohan
local config = {
levelNeeded = 8,
muteTime = 120, -- time in Seconds that the player will be without broadcasting.
storage = 7896 -- storage that controls the broadcasting of the player.
}
if param == '' then
doPlayerPopupFYI(cid, "Say '!buy Item Name, Price in GP'")
end
t = string.explode(param, ",")
if not(t[1]) or not(t[2]) then
doPlayerSendCancel(cid, "Command requires more than one parameter.")
else
if getPlayerLevel(cid) >= config.levelNeeded then
if getPlayerStorageValue(cid,config.storage) == -1 then
setPlayerStorageValue(cid, config.storage, os.time())
elseif getPlayerStorageValue(cid,config.storage) > os.time() then
doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.")
elseif getPlayerStorageValue(cid,config.storage) <= os.time() then
doBroadcastMessage("Player " .. getPlayerName(cid) .. " is buying " .. t[1] .. " for " .. t[2] .. " gold coins.")
setPlayerStorageValue(cid,config.storage, (os.time() + config.muteTime))
end
else
doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. "+ can broadcast one offer.")
end
end
return true
end
SELL .LUA
LUA:
--[[ Buy & Sell Talkaction System
Made by Yohan(me). ]]--
function onSay(cid, words, param) -- script by Yohan
local config = {
levelNeeded = 8,
muteTime = 120, -- time in Seconds that the player will be without broadcasting.
storage = 7896 -- storage that controls the broadcasting of the player.
}
if param == '' then
doPlayerPopupFYI(cid, "Say '!sell Item Name, Price in GP'")
end
t = string.explode(param, ",")
if not(t[1]) or not(t[2]) then
doPlayerSendCancel(cid, "Command requires more than one parameter.")
else
if getPlayerLevel(cid) >= config.levelNeeded then
if getPlayerStorageValue(cid,config.storage) == -1 then
setPlayerStorageValue(cid, config.storage, os.time())
elseif getPlayerStorageValue(cid,config.storage) > os.time() then
doPlayerSendCancel(cid, "You can only place one offer in " .. config.muteTime .. " seconds.")
elseif getPlayerStorageValue(cid,config.storage) <= os.time() then
doBroadcastMessage("Player " .. getPlayerName(cid) .. " is selling " .. t[1] .. " for " .. t[2] .. " gold coins.")
setPlayerStorageValue(cid,config.storage, (os.time() + config.muteTime))
end
else
doPlayerSendCancel(cid, "Only players with level " .. config.levelNeeded .. "+ can broadcast one offer.")
end
end
return true
end
validCurrencies = {9971, 2160, 2148, 2152, 2159}, maxPrice = 1000000000