Inteligentny
Im not.
- Joined
- Aug 2, 2008
- Messages
- 485
- Reaction score
- 0
Hello, I was trying to change Gesior's Santa Claus npc on Christmas Tree but its not working xD If someone could help me I will be grateful :d
Is it even possible to mix npc's scripts with those onUse?
PHP:
random_items = {
{100,2399,100}, -- 30% to get thro stars
{100,2410,1}, -- 30% to get thro knifes
{100,2488,1}, -- 1.5% to get c legs
{100,2519,1}, -- 1.5% to get c armor
{100,2306,1}, -- 100% to get 8 cookies
{50,2674,15}, -- 40% to get 15 red apples
{50,2675,10}, -- 45% to get 10 oranges
{15,2487,1}, -- 1.5% to get c armor
{20,2112,1}, -- 0.5% to get teddy bear
{300,6512,1}, -- 2% to get santa doll
{600,2114,1}, -- 4% to get piggy bank
{800,2111,10}, -- 8% to get 5 snowballs
{600,2688,8}, -- 8% to get 8 candy canes
{800,2110,1}, -- 8% to get doll
{1000,2687,8} -- 100% to get 8 cookies
}
PRESENT_STORAGE = 54148 -- storage ID
function onUse(cid, parameters, item, frompos, item2, topos)
if (parameters.present == true) then
if (getPlayerStorageValue(cid, PRESENT_STORAGE) < 1) then
local item = {}
local reward = 0
local count = ""
for i = 1, #random_items do
item = random_items[i]
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)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Marry Chrismtas, here is your present... ")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found already present.")
end
end
end
Is it even possible to mix npc's scripts with those onUse?