Hello.
I change a little this script that only vip player with storage 11551 can buy all blesses.
But even if im VIP NPC say "Sorry you are not VIP".
What's wrong ??
I change a little this script that only vip player with storage 11551 can buy all blesses.
But even if im VIP NPC say "Sorry you are not VIP".
What's wrong ??
Lua:
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
bless2 = getPlayerBlessing(cid,2)
tbless = 'Sorry, but you already have this blessing.'
tbless2 = 'Sorry, but you already have one blessing, and u cant buy all others.'
obless = 'I will give to you all blessings for only 40k, are you prepared to pay and are you VIP ?'
mbless = 'Oh. You do not have enough money.'
gbless = 'Now the Gods blessed you.'
pbless = 'Sorry, you are not VIP'
price = 40000
player_gold = getPlayerItemCount(cid,2148)
player_plat = getPlayerItemCount(cid,2152)*100
player_crys = getPlayerItemCount(cid,2160)*10000
player_money = player_gold + player_plat + player_crys
if msgcontains(msg, 'vip bless') then
if getPlayerStorageValue(cid, 11551) then
if player_money >= price then
selfSay(obless, cid)
talkState[talkUser] = 2
else
selfSay(pbless, cid)
talkState[talkUser] = 0
end
else
selfSay(mbless, cid)
talkState[talkUser] = 0
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 2 then
talkState[talkUser] = 0
if bless2 then
selfSay(tbless, cid)
else
if doPlayerRemoveMoney(cid, price) == TRUE then
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
selfSay(gbless, cid)
else
selfSay(mbless, cid)
end
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.', cid)
talkState[talkUser] = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())