Ir para conteúdo
  • Cadastre-se

Posts Recomendados

 

ok vc usa o sistema points? posta ele aqui, qro saber se é MODS, se for posta ele que edito o seu sistema ae

 

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Characters Market System" version="1.0" author="LuckOake" contact="none" enabled="yes">
------------------------------------------------------------------------------------
<config name="market"><![CDATA[
price = 27112
owner = 27113
level = 30 -- Level mínimo que o character deve ter para ser vendido
min_price = 1 -- Preço mínimo de um character
max_price = 1000 -- Preço máximo de um character
 
function doTransferCharacter(cid, accId)
return db.executeQuery("UPDATE `players` SET `account_id` = "..accId.." WHERE `id` = "..getPlayerGUIDByName(cid).."")
end
 
function doOfflinePlayerAddMoney(guid, money)
return db.executeQuery("UPDATE `players` SET `balance` = `balance` + '"..money.."' WHERE `id` = '"..getPlayerGUIDByName(guid).."';")
end
 
function setOfflinePlayerStorageValue(name, key, value)
local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
if result:getID() == -1 then
return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (".. getPlayerGUIDByName(name) ..", ".. key ..", ".. value ..");")
else
result:free()
return db.executeQuery("UPDATE `player_storage` SET `value` = ".. value .." WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
end
end
 
function getOfflinePlayerStorageValue(name, key)
local result, ret = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return nil
end
ret = result:getDataInt("value")
result:free()
return ret
end
 
function getOfflinePlayerValue(name, value)
local result, ret = db.getResult("SELECT `"..value.."` FROM `players` WHERE `id` = "..getPlayerGUIDByName(name)..";")
ret = result:getDataInt(value)
result:free()
return ret
end
 
function isCharacterForSale(name)
if not getOfflinePlayerStorageValue(name, price) or getOfflinePlayerStorageValue(name, price) < 1 then
return false
else
return true
end
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="!character" event="buffer"><![CDATA[
domodlib('market')
local t = string.explode(param, ",")
 
if t[1] == "sell" then
if not t[3] or not tonumber(t[3]) or t[4] or tonumber(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name and the price.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is already for sale.") return true
elseif getPlayerGUIDByName(t[2]) == getPlayerGUID(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot sell yourself.") return true
elseif getPlayerByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The character must be offline to be sold.") return true
elseif getOfflinePlayerValue(t[2], "level") < level then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character can't be sold until it has level "..level..".") return true
elseif tonumber(t[3]) < min_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the minimum price for selling a character is "..min_price..".") return true
elseif tonumber(t[3]) > max_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the maximum price for selling a character is "..max_price..".") return true
end
 
setOfflinePlayerStorageValue(t[2], price, t[3])
setOfflinePlayerStorageValue(t[2], owner, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" is now for sale for the price of "'..t[3]..'" points.')
elseif t[1] == "buy" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif not playerExists(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character doesn't exist.") return true
elseif getPlayerAccountId(cid) == getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't buy your own character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
elseif not doPlayerRemovePoints(cid, getOfflinePlayerStorageValue(t[2], price)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough points. This character's price is "..getOfflinePlayerStorageValue(t[2], price).." points") return true
end
local pp = getOfflinePlayerStorageValue(t[2], price) 
if not getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)) then
local dono = getPlayerGUIDByName(t[2])
db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(dono) + pp .."' WHERE `name` ='"..dono.."'")
setOfflinePlayerStorageValue(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), 41792, getPlayerGUIDByName(t[2]))
else
local dono = getPlayerByGUID(t[2])
db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(dono) + pp .."' WHERE `name` ='"..dono.."'")
doPlayerSendTextMessage(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" has been sold for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
end
doTransferCharacter(t[2], getPlayerAccountId(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought the character "'..t[2]..'" for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
setOfflinePlayerStorageValue(t[2], owner, -1)
setOfflinePlayerStorageValue(t[2], price, -1) return true
elseif t[1] == "remove" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
end
 
setOfflinePlayerStorageValue(t[2], price, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You removed the character "'..t[2]..'" from the Characters Market.') return true
elseif t[1] == "list" then
local result = db.getResult("SELECT `name` FROM `players`")
if result:getID() == -1 then
return true
end
local msg = "Characters for Sale:\n\n"
while true do
local name = result:getDataString("name")
if isCharacterForSale(name) then
local sex = getOfflinePlayerValue(name, "sex") == 1 and "Male" or "Female"
msg = ""..msg.." - ".. name .." (Level: "..getOfflinePlayerValue(name, "level").." / Vocation: "..getVocationInfo(getOfflinePlayerValue(name, "vocation")).name.." / Sex: "..sex.." / Owner: "..getPlayerNameByGUID(getOfflinePlayerStorageValue(name, owner))..") [Price: "..getOfflinePlayerStorageValue(name, price).."] \n"
end
if not result:next() then
break
end
end
doPlayerPopupFYI(cid, msg) return true
elseif not t[1] or t[1] ~= "buy" or t[1] ~= "sell" or t[1] ~= "remove" or t[1] ~= "list" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect params. You can only 'buy' or 'sell' a character, 'remove' it from the Characters Market or see the 'list' of characters for sale.") return true
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<event type="login" name="MarketLogin" event="script"><![CDATA[
function onLogin(cid)
domodlib('market')
if getPlayerStorageValue(cid, price) > 0 then return false
elseif getPlayerStorageValue(cid, 41792) ~= -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You sold the character "..getPlayerNameByGUID(getPlayerStorageValue(cid, 41792))..". The money is in your bank account.")
setPlayerStorageValue(cid, 41792, -1)
end
return true
end
]]></event>
</mod>

 

o sistema que estou usando é o

[system] Pontos "P" Points System

http://www.tibiaking.com/forum/topic/8183-system-pontos-p-points-system/

 

ele não é por MOD

 

já o sistema de Character Market é por MODS

Editado por subhe (veja o histórico de edições)

n35408.gif

Link para o post
Compartilhar em outros sites

eu sei, já testou o MODS que eu editei ali em cima?

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

eu sei, já testou o MODS que eu editei ali em cima?

 

testei, ele tah dando erro

quando uso os comandos de buy e list

os comandos de Sell e remove estão funcionando

aqui os erros que estão dando

 

os 2 primeiros erros acontece ao usar o Comando !character buy,Nome do char

e o ultimo eh o comando !character list

 

 

[04/05/2015 00:26:31] [Error - TalkAction Interface]

[04/05/2015 00:26:31] buffer

[04/05/2015 00:26:31] Description:

[04/05/2015 00:26:31] (internalGetPlayerInfo) Player not found when requesting player info #20

[04/05/2015 00:26:31] [Error - TalkAction Interface]

[04/05/2015 00:26:31] buffer

[04/05/2015 00:26:31] Description:

[04/05/2015 00:26:31] data/lib/050-function.lua:871: attempt to concatenate a boolean value

[04/05/2015 00:28:34] [Error - TalkAction Interface]

[04/05/2015 00:28:34] buffer

[04/05/2015 00:28:34] Description:

[04/05/2015 00:28:34] [string "price = 27112..."]:26: attempt to concatenate a nil value

 

Editado por subhe (veja o histórico de edições)

n35408.gif

Link para o post
Compartilhar em outros sites

essa query pega pelo nome q lixo, fiz uma nova, ta aí

 

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Characters Market System" version="1.0" author="LuckOake" contact="none" enabled="yes">
------------------------------------------------------------------------------------
<config name="market"><![CDATA[
price = 27112
owner = 27113
level = 30 -- Level mínimo que o character deve ter para ser vendido
min_price = 1 -- Preço mínimo de um character
max_price = 1000 -- Preço máximo de um character
 
 
function pegarPoints(acc)
local info = db.getResult("SELECT `p_points` FROM `accounts` WHERE `id` = "..acc)
return info:getDataInt("p_points") < 0 and 0 or info:getDataInt("p_points")
end
 
function doTransferCharacter(cid, accId)
return db.executeQuery("UPDATE `players` SET `account_id` = "..accId.." WHERE `id` = "..getPlayerGUIDByName(cid).."")
end
 
function doOfflinePlayerAddMoney(guid, money)
return db.executeQuery("UPDATE `players` SET `balance` = `balance` + '"..money.."' WHERE `id` = '"..getPlayerGUIDByName(guid).."';")
end
 
function setOfflinePlayerStorageValue(name, key, value)
local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
if result:getID() == -1 then
return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (".. getPlayerGUIDByName(name) ..", ".. key ..", ".. value ..");")
else
result:free()
return db.executeQuery("UPDATE `player_storage` SET `value` = ".. value .." WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
end
end
 
function getOfflinePlayerStorageValue(name, key)
local result, ret = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return nil
end
ret = result:getDataInt("value")
result:free()
return ret
end
 
function getOfflinePlayerValue(name, value)
local result, ret = db.getResult("SELECT `"..value.."` FROM `players` WHERE `id` = "..getPlayerGUIDByName(name)..";")
ret = result:getDataInt(value)
result:free()
return ret
end
 
function isCharacterForSale(name)
if not getOfflinePlayerStorageValue(name, price) or getOfflinePlayerStorageValue(name, price) < 1 then
return false
else
return true
end
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="!character" event="buffer"><![CDATA[
domodlib('market')
local t = string.explode(param, ",")
 
if t[1] == "sell" then
if not t[3] or not tonumber(t[3]) or t[4] or tonumber(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name and the price.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is already for sale.") return true
elseif getPlayerGUIDByName(t[2]) == getPlayerGUID(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot sell yourself.") return true
elseif getPlayerByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The character must be offline to be sold.") return true
elseif getOfflinePlayerValue(t[2], "level") < level then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character can't be sold until it has level "..level..".") return true
elseif tonumber(t[3]) < min_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the minimum price for selling a character is "..min_price..".") return true
elseif tonumber(t[3]) > max_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the maximum price for selling a character is "..max_price..".") return true
end
 
setOfflinePlayerStorageValue(t[2], price, t[3])
setOfflinePlayerStorageValue(t[2], owner, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" is now for sale for the price of "'..t[3]..'" points.')
elseif t[1] == "buy" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif not playerExists(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character doesn't exist.") return true
elseif getPlayerAccountId(cid) == getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't buy your own character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
elseif getPoints(cid) < getOfflinePlayerStorageValue(t[2], price) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough points. This character's price is "..getOfflinePlayerStorageValue(t[2], price).." points") return true
end
local pp = getOfflinePlayerStorageValue(t[2], price)
local dono = getAccountIdByName(t[2])
db.executeQuery("UPDATE `accounts` SET `p_points` = " .. pegarPoints(dono) + pp .. " WHERE `id` = "..dono)
if not getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)) then
setOfflinePlayerStorageValue(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), 41792, getPlayerGUIDByName(t[2]))
else
doPlayerSendTextMessage(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" has been sold for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
end
doPlayerRemovePoints(cid, getOfflinePlayerStorageValue(t[2], price))
doTransferCharacter(t[2], getPlayerAccountId(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought the character "'..t[2]..'" for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
setOfflinePlayerStorageValue(t[2], owner, -1)
setOfflinePlayerStorageValue(t[2], price, -1) return true
elseif t[1] == "remove" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
end
setOfflinePlayerStorageValue(t[2], price, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You removed the character "'..t[2]..'" from the Characters Market.') return true
elseif t[1] == "list" then
local result = db.getResult("SELECT `name` FROM `players`")
if result:getID() == -1 then
doPlayerPopupFYI(cid, "nenhum a venda")
return true
end
local msg = "Characters for Sale:\n\n"
while true do
local name = result:getDataString("name")
if isCharacterForSale(name) then
local sex = getOfflinePlayerValue(name, "sex") == 1 and "Male" or "Female"
msg = ""..msg.." - ".. name .." (Level: "..getOfflinePlayerValue(name, "level").." / Vocation: "..getVocationInfo(getOfflinePlayerValue(name, "vocation")).name.." / Sex: "..sex.." / Owner: "..getPlayerNameByGUID(getOfflinePlayerStorageValue(name, owner))..") [Price: "..getOfflinePlayerStorageValue(name, price).."] \n"
end
if not result:next() then
break
end
end
doPlayerPopupFYI(cid, msg) return true
elseif not t[1] or t[1] ~= "buy" or t[1] ~= "sell" or t[1] ~= "remove" or t[1] ~= "list" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect params. You can only 'buy' or 'sell' a character, 'remove' it from the Characters Market or see the 'list' of characters for sale.") return true
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<event type="login" name="MarketLogin" event="script"><![CDATA[
function onLogin(cid)
domodlib('market')
if getPlayerStorageValue(cid, price) > 0 then return false
elseif getPlayerStorageValue(cid, 41792) ~= -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You sold the character "..getPlayerNameByGUID(getPlayerStorageValue(cid, 41792))..". The points is in your account.")
setPlayerStorageValue(cid, 41792, -1)
end
return true
end
]]></event>
</mod>

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

 

essa query pega pelo nome q lixo, fiz uma nova, ta aí

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Characters Market System" version="1.0" author="LuckOake" contact="none" enabled="yes">
------------------------------------------------------------------------------------
<config name="market"><![CDATA[
price = 27112
owner = 27113
level = 30 -- Level mínimo que o character deve ter para ser vendido
min_price = 1 -- Preço mínimo de um character
max_price = 1000 -- Preço máximo de um character
 
 
function pegarPoints(acc)
local info = db.getResult("SELECT `p_points` FROM `accounts` WHERE `id` = "..acc)
return info:getDataInt("p_points") < 0 and 0 or info:getDataInt("p_points")
end
 
function doTransferCharacter(cid, accId)
return db.executeQuery("UPDATE `players` SET `account_id` = "..accId.." WHERE `id` = "..getPlayerGUIDByName(cid).."")
end
 
function doOfflinePlayerAddMoney(guid, money)
return db.executeQuery("UPDATE `players` SET `balance` = `balance` + '"..money.."' WHERE `id` = '"..getPlayerGUIDByName(guid).."';")
end
 
function setOfflinePlayerStorageValue(name, key, value)
local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
if result:getID() == -1 then
return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (".. getPlayerGUIDByName(name) ..", ".. key ..", ".. value ..");")
else
result:free()
return db.executeQuery("UPDATE `player_storage` SET `value` = ".. value .." WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
end
end
 
function getOfflinePlayerStorageValue(name, key)
local result, ret = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return nil
end
ret = result:getDataInt("value")
result:free()
return ret
end
 
function getOfflinePlayerValue(name, value)
local result, ret = db.getResult("SELECT `"..value.."` FROM `players` WHERE `id` = "..getPlayerGUIDByName(name)..";")
ret = result:getDataInt(value)
result:free()
return ret
end
 
function isCharacterForSale(name)
if not getOfflinePlayerStorageValue(name, price) or getOfflinePlayerStorageValue(name, price) < 1 then
return false
else
return true
end
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="!character" event="buffer"><![CDATA[
domodlib('market')
local t = string.explode(param, ",")
 
if t[1] == "sell" then
if not t[3] or not tonumber(t[3]) or t[4] or tonumber(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name and the price.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is already for sale.") return true
elseif getPlayerGUIDByName(t[2]) == getPlayerGUID(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot sell yourself.") return true
elseif getPlayerByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The character must be offline to be sold.") return true
elseif getOfflinePlayerValue(t[2], "level") < level then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character can't be sold until it has level "..level..".") return true
elseif tonumber(t[3]) < min_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the minimum price for selling a character is "..min_price..".") return true
elseif tonumber(t[3]) > max_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the maximum price for selling a character is "..max_price..".") return true
end
 
setOfflinePlayerStorageValue(t[2], price, t[3])
setOfflinePlayerStorageValue(t[2], owner, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" is now for sale for the price of "'..t[3]..'" points.')
elseif t[1] == "buy" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif not playerExists(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character doesn't exist.") return true
elseif getPlayerAccountId(cid) == getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't buy your own character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
elseif getPoints(cid) < getOfflinePlayerStorageValue(t[2], price) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough points. This character's price is "..getOfflinePlayerStorageValue(t[2], price).." points") return true
end
local pp = getOfflinePlayerStorageValue(t[2], price)
local dono = getAccountIdByName(t[2])
db.executeQuery("UPDATE `accounts` SET `p_points` = " .. pegarPoints(dono) + pp .. " WHERE `id` = "..dono)
if not getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)) then
setOfflinePlayerStorageValue(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), 41792, getPlayerGUIDByName(t[2]))
else
doPlayerSendTextMessage(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" has been sold for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
end
doPlayerRemovePoints(cid, getOfflinePlayerStorageValue(t[2], price))
doTransferCharacter(t[2], getPlayerAccountId(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought the character "'..t[2]..'" for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
setOfflinePlayerStorageValue(t[2], owner, -1)
setOfflinePlayerStorageValue(t[2], price, -1) return true
elseif t[1] == "remove" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
end
setOfflinePlayerStorageValue(t[2], price, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You removed the character "'..t[2]..'" from the Characters Market.') return true
elseif t[1] == "list" then
local result = db.getResult("SELECT `name` FROM `players`")
if result:getID() == -1 then
doPlayerPopupFYI(cid, "nenhum a venda")
return true
end
local msg = "Characters for Sale:\n\n"
while true do
local name = result:getDataString("name")
if isCharacterForSale(name) then
local sex = getOfflinePlayerValue(name, "sex") == 1 and "Male" or "Female"
msg = ""..msg.." - ".. name .." (Level: "..getOfflinePlayerValue(name, "level").." / Vocation: "..getVocationInfo(getOfflinePlayerValue(name, "vocation")).name.." / Sex: "..sex.." / Owner: "..getPlayerNameByGUID(getOfflinePlayerStorageValue(name, owner))..") [Price: "..getOfflinePlayerStorageValue(name, price).."] \n"
end
if not result:next() then
break
end
end
doPlayerPopupFYI(cid, msg) return true
elseif not t[1] or t[1] ~= "buy" or t[1] ~= "sell" or t[1] ~= "remove" or t[1] ~= "list" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect params. You can only 'buy' or 'sell' a character, 'remove' it from the Characters Market or see the 'list' of characters for sale.") return true
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<event type="login" name="MarketLogin" event="script"><![CDATA[
function onLogin(cid)
domodlib('market')
if getPlayerStorageValue(cid, price) > 0 then return false
elseif getPlayerStorageValue(cid, 41792) ~= -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You sold the character "..getPlayerNameByGUID(getPlayerStorageValue(cid, 41792))..". The points is in your account.")
setPlayerStorageValue(cid, 41792, -1)
end
return true
end
]]></event>
</mod>

funcionou o comando buy, está comprando o character certinho(pagando em points) o jogador recebe os points certinho

só tem um problema, o comando !Character list, pra mostrar os char que estão a venda, não está funcionando

 

erro que aparece no console

 

[04/05/2015 19:39:12] [Error - TalkAction Interface]

[04/05/2015 19:39:12] buffer

[04/05/2015 19:39:12] Description:

[04/05/2015 19:39:12] [string "price = 27112..."]:32: attempt to concatenate a nil value

Editado por subhe (veja o histórico de edições)

n35408.gif

Link para o post
Compartilhar em outros sites

ue aqui estava aparecendo, qual é o seu distro?

 

Sg1rjgR.jpg

ta aparecendo '-'

 

 

 

obs: se não der, retira todos as conta que estão pra vender e coloca vender de novo

 

 

e eu refiz o talk usando repeat...

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Characters Market System" version="1.0" author="LuckOake" contact="none" enabled="yes">
------------------------------------------------------------------------------------
<config name="market"><![CDATA[
price = 27112
owner = 27113
level = 30 -- Level mínimo que o character deve ter para ser vendido
min_price = 1 -- Preço mínimo de um character
max_price = 1000 -- Preço máximo de um character
 
 
function pegarPoints(acc)
local info = db.getResult("SELECT `p_points` FROM `accounts` WHERE `id` = "..acc)
return info:getDataInt("p_points") < 0 and 0 or info:getDataInt("p_points")
end
 
function doTransferCharacter(cid, accId)
return db.executeQuery("UPDATE `players` SET `account_id` = "..accId.." WHERE `id` = "..getPlayerGUIDByName(cid).."")
end
 
function doOfflinePlayerAddMoney(guid, money)
return db.executeQuery("UPDATE `players` SET `balance` = `balance` + '"..money.."' WHERE `id` = '"..getPlayerGUIDByName(guid).."';")
end
 
function setOfflinePlayerStorageValue(name, key, value)
local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
if result:getID() == -1 then
return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (".. getPlayerGUIDByName(name) ..", ".. key ..", ".. value ..");")
else
result:free()
return db.executeQuery("UPDATE `player_storage` SET `value` = ".. value .." WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
end
end
 
function getOfflinePlayerStorageValue(name, key)
local result, ret = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return nil
end
ret = result:getDataInt("value")
result:free()
return ret
end
 
function getOfflinePlayerValue(name, value)
local result, ret = db.getResult("SELECT `"..value.."` FROM `players` WHERE `id` = "..getPlayerGUIDByName(name)..";")
ret = result:getDataInt(value)
result:free()
return ret
end
 
function isCharacterForSale(name)
if not getOfflinePlayerStorageValue(name, price) or getOfflinePlayerStorageValue(name, price) < 1 then
return false
else
return true
end
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="!character" event="buffer"><![CDATA[
domodlib('market')
local t = string.explode(param, ",")
 
if t[1] == "sell" then
if not t[3] or not tonumber(t[3]) or t[4] or tonumber(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name and the price.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is already for sale.") return true
elseif getPlayerGUIDByName(t[2]) == getPlayerGUID(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot sell yourself.") return true
elseif getPlayerByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The character must be offline to be sold.") return true
elseif getOfflinePlayerValue(t[2], "level") < level then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character can't be sold until it has level "..level..".") return true
elseif tonumber(t[3]) < min_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the minimum price for selling a character is "..min_price..".") return true
elseif tonumber(t[3]) > max_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the maximum price for selling a character is "..max_price..".") return true
end
 
setOfflinePlayerStorageValue(t[2], price, t[3])
setOfflinePlayerStorageValue(t[2], owner, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" is now for sale for the price of "'..t[3]..'" points.')
elseif t[1] == "buy" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif not playerExists(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character doesn't exist.") return true
elseif getPlayerAccountId(cid) == getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't buy your own character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
elseif getPoints(cid) < getOfflinePlayerStorageValue(t[2], price) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough points. This character's price is "..getOfflinePlayerStorageValue(t[2], price).." points") return true
end
local pp = getOfflinePlayerStorageValue(t[2], price)
local dono = getAccountIdByName(t[2])
db.executeQuery("UPDATE `accounts` SET `p_points` = " .. pegarPoints(dono) + pp .. " WHERE `id` = "..dono)
if not getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)) then
setOfflinePlayerStorageValue(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), 41792, getPlayerGUIDByName(t[2]))
else
doPlayerSendTextMessage(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" has been sold for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
end
doPlayerRemovePoints(cid, getOfflinePlayerStorageValue(t[2], price))
doTransferCharacter(t[2], getPlayerAccountId(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought the character "'..t[2]..'" for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
setOfflinePlayerStorageValue(t[2], owner, -1)
setOfflinePlayerStorageValue(t[2], price, -1) return true
elseif t[1] == "remove" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
end
setOfflinePlayerStorageValue(t[2], price, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You removed the character "'..t[2]..'" from the Characters Market.') return true
elseif t[1] == "list" then
local result = db.getResult("SELECT `name` FROM `players`")
if result:getID() == -1 then
return true
end
local msg = "Characters for Sale:\n\n"
repeat
local name = result:getDataString("name")
if isCharacterForSale(name) then
local sex = getOfflinePlayerValue(name, "sex") == 1 and "Male" or "Female"
msg = ""..msg.." - ".. name .." (Level: "..getOfflinePlayerValue(name, "level").." / Vocation: "..getVocationInfo(getOfflinePlayerValue(name, "vocation")).name.." / Sex: "..sex.." / Owner: "..getPlayerNameByGUID(getOfflinePlayerStorageValue(name, owner))..") [Price: "..getOfflinePlayerStorageValue(name, price).."] \n"
end
until not result:next() 
result:free() 
return doPlayerPopupFYI(cid, msg)
elseif not t[1] or t[1] ~= "buy" or t[1] ~= "sell" or t[1] ~= "remove" or t[1] ~= "list" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect params. You can only 'buy' or 'sell' a character, 'remove' it from the Characters Market or see the 'list' of characters for sale.") return true
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<event type="login" name="MarketLogin" event="script"><![CDATA[
function onLogin(cid)
domodlib('market')
if getPlayerStorageValue(cid, price) > 0 then return false
elseif getPlayerStorageValue(cid, 41792) ~= -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You sold the character "..getPlayerNameByGUID(getPlayerStorageValue(cid, 41792))..". The points is in your account.")
setPlayerStorageValue(cid, 41792, -1)
end
return true
end
]]></event>
</mod>
Editado por Vodkart (veja o histórico de edições)

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

ainda nao funcionou, da o mesmo erro

 

eu uso essa distro aqui

 

[04/05/2015 20:54:46] The Lost Server, version 1.0 (Scorpion)
[04/05/2015 20:54:46] Compiled with GNU C++ version 3.4.5 (mingw special) at Aug 27 2013, 03:08:13.
[04/05/2015 20:54:46] A server developed by Elf, slawkens, Talaturen, KaczooH, Lithium, Kiper, Kornholijo.

 

vou testar em outro OTserv qualquer coisa edito aqui

 

testei em outro servidor aqui version 0.4

e não funcionou

é como se nao tivesse o comando !character list

eu uso ele, ai aparece que nao tem o comando, ai aparece os comando que tem "buy" and "Sell" and "remove"

aparece assim

 

em que mapa e versão vc testou ele ?

Editado por subhe (veja o histórico de edições)

n35408.gif

Link para o post
Compartilhar em outros sites

8.6 baiak... vo ver outro jeito e ja edito

 

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Characters Market System" version="1.0" author="LuckOake" contact="none" enabled="yes">
------------------------------------------------------------------------------------
<config name="market"><![CDATA[
price = 27112
owner = 27113
level = 30 -- Level mínimo que o character deve ter para ser vendido
min_price = 1 -- Preço mínimo de um character
max_price = 1000 -- Preço máximo de um character
 
function doTransferCharacter(cid, accId)
return db.executeQuery("UPDATE `players` SET `account_id` = "..accId.." WHERE `id` = "..getPlayerGUIDByName(cid).."")
end
 
function doOfflinePlayerAddMoney(guid, money)
return db.executeQuery("UPDATE `players` SET `balance` = `balance` + '"..money.."' WHERE `id` = '"..getPlayerGUIDByName(guid).."';")
end
 
function setOfflinePlayerStorageValue(name, key, value)
local result = db.getResult("SELECT * FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
if result:getID() == -1 then
return db.executeQuery("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES (".. getPlayerGUIDByName(name) ..", ".. key ..", ".. value ..");")
else
result:free()
return db.executeQuery("UPDATE `player_storage` SET `value` = ".. value .." WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. key ..";")
end
end
 
function getOfflinePlayerStorageValue(name, key)
local result = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = '".. getPlayerGUIDByName(name) .."' AND `key` = ".. key ..";")
if result:getID() == -1 then
return true
end
return result:getDataInt("value")
end
 
function getOfflinePlayerValue(name, value)
local result, ret = db.getResult("SELECT `"..value.."` FROM `players` WHERE `id` = "..getPlayerGUIDByName(name)..";")
ret = result:getDataInt(value)
result:free()
return ret
end
 
function isCharacterForSale(name)
if not getOfflinePlayerStorageValue(name, price) or getOfflinePlayerStorageValue(name, price) < 1 then
return false
else
return true
end
end
]]></config>
------------------------------------------------------------------------------------
<talkaction words="!character" event="buffer"><![CDATA[
domodlib('market')
local t = string.explode(param, ",")
 
if t[1] == "sell" then
if not t[3] or not tonumber(t[3]) or t[4] or tonumber(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name and the price.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is already for sale.") return true
elseif getPlayerGUIDByName(t[2]) == getPlayerGUID(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot sell yourself.") return true
elseif getPlayerByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "The character must be offline to be sold.") return true
elseif getOfflinePlayerValue(t[2], "level") < level then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Your character can't be sold until it has level "..level..".") return true
elseif tonumber(t[3]) < min_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the minimum price for selling a character is "..min_price..".") return true
elseif tonumber(t[3]) > max_price then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Sorry, but the maximum price for selling a character is "..max_price..".") return true
end
 
setOfflinePlayerStorageValue(t[2], price, t[3])
setOfflinePlayerStorageValue(t[2], owner, getPlayerGUID(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" is now for sale for the price of "'..t[3]..'" points.')
elseif t[1] == "buy" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif not playerExists(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character doesn't exist.") return true
elseif getPlayerAccountId(cid) == getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You can't buy your own character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
elseif not doPlayerRemovePoints(cid, getOfflinePlayerStorageValue(t[2], price)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Not enough points. This character's price is "..getOfflinePlayerStorageValue(t[2], price).." points") return true
end
local pp = getOfflinePlayerStorageValue(t[2], price) 
if not getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)) then
local dono = getPlayerGUIDByName(t[2])
db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(dono) + pp .."' WHERE `name` ='"..dono.."'")
setOfflinePlayerStorageValue(getPlayerNameByGUID(getOfflinePlayerStorageValue(t[2], owner)), 41792, getPlayerGUIDByName(t[2]))
else
local dono = getPlayerByGUID(t[2])
db.executeQuery("UPDATE `accounts` SET `p_points` = '".. getPoints(dono) + pp .."' WHERE `name` ='"..dono.."'")
doPlayerSendTextMessage(getPlayerByGUID(getOfflinePlayerStorageValue(t[2], owner)), MESSAGE_STATUS_CONSOLE_BLUE, 'Your character "'..t[2]..'" has been sold for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
end
doTransferCharacter(t[2], getPlayerAccountId(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You bought the character "'..t[2]..'" for the price of '..getOfflinePlayerStorageValue(t[2], price)..' points.')
setOfflinePlayerStorageValue(t[2], owner, -1)
setOfflinePlayerStorageValue(t[2], price, -1) return true
elseif t[1] == "remove" then
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Incorrect Params. Specify the character name.") return true
elseif getPlayerAccountId(cid) ~= getAccountIdByName(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This is not your character.") return true
elseif not isCharacterForSale(t[2]) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "This character is not for sale.") return true
end
 
setOfflinePlayerStorageValue(t[2], price, -1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'You removed the character "'..t[2]..'" from the Characters Market.') return true
elseif t[1] == "list" then
local result = db.getResult("SELECT `name` FROM `players`")
if result:getID() == -1 then
doPlayerPopupFYI(cid, "nenhum a venda")
return true
end
local msg = "Characters for Sale:\n\n"
while true do
local name = result:getDataString("name")
if isCharacterForSale(name) then
local sex = getOfflinePlayerValue(name, "sex") == 1 and "Male" or "Female"
msg = ""..msg.." - ".. name .." (Level: "..getOfflinePlayerValue(name, "level").." / Vocation: "..getVocationInfo(getOfflinePlayerValue(name, "vocation")).name.." / Sex: "..sex.." / Owner: "..getPlayerNameByGUID(getOfflinePlayerStorageValue(name, owner))..") [Price: "..getOfflinePlayerStorageValue(name, price).."] \n"
end
if not result:next() then
break
end
end
doPlayerPopupFYI(cid, msg) return true
elseif not t[1] or t[1] ~= "buy" or t[1] ~= "sell" or t[1] ~= "remove" or t[1] ~= "list" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Incorrect params. You can only 'buy' or 'sell' a character, 'remove' it from the Characters Market or see the 'list' of characters for sale.") return true
end
return true
]]></talkaction>
------------------------------------------------------------------------------------
<event type="login" name="MarketLogin" event="script"><![CDATA[
function onLogin(cid)
domodlib('market')
if getPlayerStorageValue(cid, price) > 0 then return false
elseif getPlayerStorageValue(cid, 41792) ~= -1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You sold the character "..getPlayerNameByGUID(getPlayerStorageValue(cid, 41792))..". The money is in your bank account.")
setPlayerStorageValue(cid, 41792, -1)
end
return true
end
]]></event>
</mod>
Editado por Vodkart (veja o histórico de edições)

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites

vou testar

jaja edito

 

Ediit: ainda nao está funcionando

 

se ajudar, estou usando um Mapa Alissow 4.11

e um mapa Infinity Sky pra testar os scripts ;x

 

 

[04/05/2015 22:14:52] [Error - TalkAction Interface]
[04/05/2015 22:14:52] buffer
[04/05/2015 22:14:52] Description:
[04/05/2015 22:14:52] [string "price = 27112..."]:41: attempt to compare boolean with number

Editado por subhe (veja o histórico de edições)

n35408.gif

Link para o post
Compartilhar em outros sites

responde minha msg, me adc skype q é mais fácil

 

thiago.vodkart

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#6090

 

Link para o post
Compartilhar em outros sites
  • 3 years later...

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo