Ir para conteúdo
  • 0

outbreaks

Pergunta

Tipo Eu queria um Npc que colokase as Roupas pra Vende

so que ao invez de usa dinheiro, vc usa

diamond! " Base PDA"

 

 

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local outs = {
--[nome da outfit] = {sto, {id male, id female}}
["jamaican"] = {181601, {m = 587, f = 588}},
["rapper"] = {181602, {m = 545, f = 512}},
["oriental"] = {181603, {m = 585, f = 586}},
["adventurer"] = {181605, {m = 494, f = 495}},
["bussines"] = {181606, {m = 1419, f = 513}},
["atletic"] = {181607, {m = 516, f = 517}},
["punk"] = {181608, {m = 518, f = 519}},
["mercenary"] = {181610, {m = 522, f = 524}},
["hiker"] = {181611, {m = 523, f = 525}},
["hunter"] = {181645, {m = 1015, f = 1016}},
}
msg = string.lower(msg)
--local outfit = ""

if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("I sell this outfits: {Jamaican, Rapper, Oriental, Adventurer, Bussines, Atletic, Punk, Mercenary, Hiker and Hunter}, which outfit do you want??", cid)
talkState[talkUser] = 2
elseif outs[msg] and talkState[talkUser] == 2 then
selfSay("Are you sure which want buy that outfit?", cid)
outfit = msg
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, outs[outfit][1]) <= 0 then
if getPlayerPremiumDays(cid) > 0 then
if getPlayerMoney(cid) >= 20000 then
if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
doPlayerAddOutfit(cid, outs[outfit][2].f, 0)
doPlayerRemoveMoney(cid, 20000)
setPlayerStorageValue(cid, outs[outfit][1], 1)
else
doPlayerAddOutfit(cid, outs[outfit][2].m, 0)
doPlayerRemoveMoney(cid, 20000)
setPlayerStorageValue(cid, outs[outfit][1], 1)
end
else
selfSay("You need 200dl to buy this outfit!", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("You already have this outfit, so please, choose another outfit...", cid)
talkState[talkUser] = 0
return false
end
selfSay("So... Here is.", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("So... Please choose another outfit...", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

 

 

script, tipo so queria muda o money pra diamond

ao invez compra com dinheiro

precisa de diamonds!

Editado por outbreaks
Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

Tenta:

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local outs = {
--[nome da outfit] = {sto, {id male, id female}, custo em diamonds}
["jamaican"] = {181601, {m = 587, f = 588}, 5},
["rapper"] = {181602, {m = 545, f = 512}, 5},
["oriental"] = {181603, {m = 585, f = 586}, 5},
["adventurer"] = {181605, {m = 494, f = 495}, 5},
["bussines"] = {181606, {m = 1419, f = 513}, 5},
["atletic"] = {181607, {m = 516, f = 517}, 5},
["punk"] = {181608, {m = 518, f = 519}, 5},
["mercenary"] = {181610, {m = 522, f = 524}, 5},
["hiker"] = {181611, {m = 523, f = 525}, 5},
["hunter"] = {181645, {m = 1015, f = 1016}, 5},
}
msg = string.lower(msg)
--local outfit = ""
if (msgcontains(msg, 'outfit') or msgcontains(msg, 'outfits')) then
selfSay("I sell this outfits: {Jamaican, Rapper, Oriental, Adventurer, Bussines, Atletic, Punk, Mercenary, Hiker and Hunter}, which outfit do you want??", cid)
talkState[talkUser] = 2
elseif outs[msg] and talkState[talkUser] == 2 then
selfSay("Are you sure which want buy that outfit?", cid)
outfit = msg
talkState[talkUser] = 3
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 3 then
if getPlayerStorageValue(cid, outs[outfit][1]) <= 0 then
if getPlayerPremiumDays(cid) > 0 then
if getPlayerItemCount(cid, 2145) >= outs[outfit][3] then
if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then
doPlayerAddOutfit(cid, outs[outfit][2].f, 0)
doPlayerRemoveItem(cid, 2145, outs[outfit][3])
setPlayerStorageValue(cid, outs[outfit][1], 1)
else
doPlayerAddOutfit(cid, outs[outfit][2].m, 0)
doPlayerRemoveItem(cid, 2145, outs[outfit][3])
setPlayerStorageValue(cid, outs[outfit][1], 1)
end
else
selfSay("You need "..outs[outfit][3].." diamonds to buy this outfit!", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("Need be premium to buy this Outfit.", cid)
talkState[talkUser] = 0
return false
end
else
selfSay("You already have this outfit, so please, choose another outfit...", cid)
talkState[talkUser] = 0
return false
end
selfSay("So... Here is.", cid)
talkState[talkUser] = 0
return true
elseif msgcontains(msg, 'no') and talkState[talkUser] == 3 then
selfSay("So... Please choose another outfit...", cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Editado por zipter98
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...