[Encerrado] Comprar outfit por comando

carlosr
em Tópicos Sem Resposta

carlosr

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 02/09/17Posts: 5Gênero: Masculino

Boa noite, uso Poketibia base DxP, queria um script para comprar outfit por comando, estou querendo para colocar no Diamond Shop do client eu só preciso da script do talkactions,  no client e xml eu sei configurar. Este código deu certo, ele add a outfit mas não remove o diamond que é o ID  2145, se alguém puder ajudar eu agradeço.

function onSay(cid, words, param)

local storage = 9999 -- mão mexa
local itemid = 2145 -- id do item que vai remover
local count = 10 -- quantidade do item que vai remover
local looktype = 2192 -- O Looktype da outift que vai ser vendida


if getPlayerStorageValue(cid, storage) >= 1 then
doPlayerSendTextMessage(cid, 22, "Desculpe voce ja comprou essa outift")
return true
end
if doPlayerRemoveItem(cid,itemid,count) then
doPlayerSendTextMessage(cid, 22, "Você não tem dinheiro suficiente")
return true
end
doPlayerAddOutfit(cid,looktype,3)
setPlayerStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou a outift")
return true
end

 

Poke X Ice

avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 16/11/16Posts: 215Gênero: Masculino

testa assim

 

Spoiler

function onSay(cid, words, param)

local storage = 9999 -- mão mexa
local itemid = 2145 -- id do item que vai remover
local count = 10 -- quantidade do item que vai remover
local looktype = 2192 -- O Looktype da outift que vai ser vendida


if getPlayerStorageValue(cid, storage) >= 1 then
doPlayerSendTextMessage(cid, 22, "Desculpe voce ja comprou essa outift")
elseif doPlayerRemoveItem(cid,itemid,count) then
doPlayerSendTextMessage(cid, 22, "Você não tem dinheiro suficiente")
elseif doPlayerAddOutfit(cid,looktype,3) then
setPlayerStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou a outfit")
end 
return true
end

 

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino

Vai no outfits.xml e me passa o ids que estão na parte "quests"

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

 

 

carlosr

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 02/09/17Posts: 5Gênero: Masculino
Em 11/08/2018 em 16:53, Marshmello disse:

Vai no outfits.xml e me passa o ids que estão na parte "quests"

<outfit id="108" quest="123456">
<list gender="0" lookType="2191" name="Blastoise Robot"/>
<list gender="1" lookType="2191" name="Blastoise Robot"/>
</outfit>

<outfit id="109" quest="9999">
<list gender="0" lookType="2192" name="Magmar Robot"/>
<list gender="1" lookType="2192" name="Magmar Robot"/>
</outfit>
 

Em 10/08/2018 em 23:06, Poke X Ice disse:

testa assim

 

  Ocultar conteúdo

function onSay(cid, words, param)

local storage = 9999 -- mão mexa
local itemid = 2145 -- id do item que vai remover
local count = 10 -- quantidade do item que vai remover
local looktype = 2192 -- O Looktype da outift que vai ser vendida


if getPlayerStorageValue(cid, storage) >= 1 then
doPlayerSendTextMessage(cid, 22, "Desculpe voce ja comprou essa outift")
elseif doPlayerRemoveItem(cid,itemid,count) then
doPlayerSendTextMessage(cid, 22, "Você não tem dinheiro suficiente")
elseif doPlayerAddOutfit(cid,looktype,3) then
setPlayerStorageValue(cid, storage, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou a outfit")
end 
return true
end

 

Deu erro na distro

Poke X Ice

avatar
Barão
Barão

INFOS

Grupo: BarãoRegistrado: 16/11/16Posts: 215Gênero: Masculino
42 minutos atrás, carlosr disse:

Deu erro na distro

poderia enviar o erro que deu na distro?

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino

@carlosr

Testa e me diz oque deu

Spoiler

local config = {

palavra1 = 'outfit',
palavra2 = 'outfit2',
sto1 = 123456,
sto2 = 9999,
item = 2145,
qnt = 10,
}

function onSay(cid, words, param)

if (param == palavra1) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto1, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto1) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

if (param == palavra2) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto2, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto2) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

return true

end

 

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

 

 

carlosr

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 02/09/17Posts: 5Gênero: Masculino
22 horas atrás, Marshmello disse:

@carlosr

Testa e me diz oque deu

  Ocultar conteúdo

local config = {

palavra1 = 'outfit',
palavra2 = 'outfit2',
sto1 = 123456,
sto2 = 9999,
item = 2145,
qnt = 10,
}

function onSay(cid, words, param)

if (param == palavra1) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto1, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto1) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

if (param == palavra2) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto2, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto2) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

return true

end

 

Não deu erro mas eu digito o comando e não da em nada

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino

@carlosr Erro meu Teste

Spoiler

local config = {

palavra1 = 'outfit',
palavra2 = 'outfit2',
sto1 = 123456,
sto2 = 9999,
item = 2145,
qnt = 10,
}

function onSay(cid, words, param)

if(param == config.palavra1) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto1, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto1) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

if (param == config.palavra2) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto2, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto2) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

return true

end

 

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

 

 

sidneirodrigues

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/07/18Posts: 6
15 horas atrás, Marshmello disse:

@carlosr Erro meu Teste

  Mostrar conteúdo oculto

local config = {

palavra1 = 'outfit',
palavra2 = 'outfit2',
sto1 = 123456,
sto2 = 9999,
item = 2145,
qnt = 10,
}

function onSay(cid, words, param)

if(param == config.palavra1) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto1, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto1) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

if (param == config.palavra2) then
if getPlayerItemCount(cid,config.item) >= config.qnt then 
setPlayerStorageValue(cid, config.sto2, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveItem(cid, config.item,config.qnt)
elseif getPlayerStorageValue(cid, sto2) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 diamonds")
end
end

return true

end

 

consegue adaptar pra vender por "pontos" no lugar do id 2145 ? 

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino
7 horas atrás, sidneirodrigues disse:

consegue adaptar pra vender por "pontos" no lugar do id 2145 ? 

Como assim , ao invez de combrar o diamond cobrar o premium pontos?

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

 

 

sidneirodrigues

avatar
Campones
Campones

INFOS

Grupo: CamponesRegistrado: 29/07/18Posts: 6
11 horas atrás, Marshmello disse:

Como assim , ao invez de combrar o diamond cobrar o premium pontos?

Sim akeles premium point do shop de website , so que invez do nome "premium points" , no meu servidor se chama "pontos" 

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino

@sidneirodrigues

 

em 00-function(lib)

Spoiler

function getPlayerVipPoints(cid)
    local Info = db.getResult("SELECT premium_points FROM accounts WHERE id = " .. getPlayerAccountId(cid) .. "")
        if Info:getID() ~= LUA_ERROR then
        local Points= Info:getDataInt("premium_points")
        Info:free()
        return Points
    end
     return LUA_ERROR
end

function doPlayerAddVipPoints(cid, points)
    local dif = getPlayerVipPoints(cid) + points
    if dif >= 0 then
        db.executeQuery("UPDATE accounts SET premium_points = premium_points + " .. points .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
        return TRUE
    end
    return FALSE
end

function doPlayerRemoveVipPoints(cid, points)
    local dif = getPlayerVipPoints(cid) - points
    if dif >= 0 then
        db.executeQuery("UPDATE accounts SET premium_points = premium_points - " .. points .. " WHERE id = " .. getPlayerAccountId(cid) .. ";")
        return TRUE
    end
    return FALSE
end
 

 

Talkactions

Spoiler

local config = {

palavra1 = 'outfit',
palavra2 = 'outfit2',
sto1 = 123456,
sto2 = 9999,
item = 2145,
qnt1 = 10,
qnt2 = 10,
}

function onSay(cid, words, param)

if(param == config.palavra1) then
if getPlayerVipPoints(cid) >= config.qnt1 then 
setPlayerStorageValue(cid, config.sto1, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveVipPoints(cid,config.qnt1)
elseif getPlayerStorageValue(cid, sto1) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 pontos")
end
end

if (param == config.palavra2) then
if getPlayerVipPoints(cid) >= config.qnt2 then 
setPlayerStorageValue(cid, config.sto2, 1)
doPlayerSendTextMessage(cid, 22, "Você comprou uma outfit")
doPlayerRemoveVipPoints(cid,config.qnt2)
elseif getPlayerStorageValue(cid, sto2) == -1 then
doPlayerSendTextMessage(cid,19, "Você já comprou essa outfit")
else
doPlayerSendTextMessage(cid, 19," você não não tem 10 pontos")
end
end

return true

end

 

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end

 

 

 

Marshmello

Alone ~ [✖‿✖]
avatar
Conde
Conde

INFOS

Grupo: CondeRegistrado: 21/04/16Posts: 831Gênero: Masculino
A questão neste suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.

placa1.png.90a184502351cebe72cd7b69751e551d.png

Meu Facebook

INFOS:

Citar

CIDADE: Rio de janeiro

Idade: 22 anos
SOU: {"Scripter(lua)", "WebMaster", "ProgramadorC++"}
 

local config = {
	delrey = getPlayerCarValue(cid, DELREY),
	cigarro = getPlayerCancer(cid, DERBY),
	prostituta = getPlayerAIDS(cid, cracuda),
	tresOitao = getPlayerRevorvi(cid, 38)
}
if(delrey == "Ligado" and cigarro == "Aceso" and prostituta == "No Colo" and tresOitao == "Carregado") then
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Começou o fim de semana. #PAS")
end