Não faço idéia de como é seu sistema vip, se passasse daria pra fazer completo.
Então é só alterar a parte onde muda o storage value.
npcvip.xml
<?xml version="1.0"?>
<npc name="Nome do NPC" script="npcvip.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="128" head="17" body="54" legs="114" feet="0" addons="2"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Vendo {vip}." />
</parameters>
</npc>
npcvip.lua
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
local talkState = {}
local price = 10
local coinId = 2159
local storageVip = 100000
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'vip') then
selfSay('A VIP custa '..price..' vip coins. Deseja comprar?', cid)
talkState[talkUser] = 1
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then
if getPlayerItemCount(cid, coinId) >= price then
doPlayerRemoveItem(cid, coinId, price)
doPlayerSetStorageValue(cid, storageVip, getPlayerStorageValue(cid, storageVip)+10)
selfSay('Sua VIP foi adicionada!', cid)
else
selfSay('Você não possui '..price..' vip coins.', cid)
end
talkState[talkUser] = 0
elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then
selfSay('Ok.', cid)
talkState[talkUser] = 0
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
~ Kydrai
Programador / Scripter