szajker123
New Member
- Joined
- May 12, 2012
- Messages
- 195
- Reaction score
- 0
Hi, so I have a script for Santa Claus and would be remade by someone (I do not know how) to make it to the level of the NPC or write on a level hi> and he will write off you no have a lvl 50. / / / And maybe someone knows why the NPC disappears after a few minutes? (I know how poorly English)
and here is the script.
and here is the script.
local gifts = {
{10, 12088, 1}, -- 1% to get exp box 20% [10]
{40, 11780, 1}, -- 4% to get white legs [40]
{100, 11802, 1}, -- 10% to get 1 pedobear mask [100]
{150, 11448, 1}, -- 15% to get 1 sasuke bandagle [150]
{150, 11419, 1}, -- 15% to get 1 basebool [150]
{200, 11470, 1}, -- 20% to get 1 sakura armor [200]
{250, 11513, 20}, -- 25% to get 20 ice cream [250]
{350, 8306, 3}, -- 35% to get 3 upgrade small
{400, 2160, 2}, -- 40% to get rues [40]
}
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
function SantaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
if (getPlayerStorageValue(cid, PRESENT_STORAGE) == 1) then
selfSay("You have a present.Did not cheat Santa Claus .", cid)
return true
end
local item = {}
local reward = 0
local count = ""
for i = 1, #gifts do
item = gifts
if (math.random(0,999) < item[1]) then
reward = item[2]
subType = item[3]
if subType > 1 then
count = subType .. " "
end
break
end
end
doPlayerAddItem(cid, reward, subType)
setPlayerStorageValue(cid, PRESENT_STORAGE, 1)
npcHandler:say('HO-HO-HO! Hello' .. count .. getItemNameById(reward) .. ' Please.', cid)
else
npcHandler:say('By the next Christmas!', cid)
end
npcHandler:resetNpc()
return true
end
npcHandler:setMessage(MESSAGE_GREET, "HO-HO-HO I have a present for you(Present).")
local noNode = KeywordNode:new({'no'}, SantaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, SantaNPC, {present = true})
local node = keywordHandler:addKeyword({'present'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Have you polite in this year?...(YES FOR NO)'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())