#1 2012-06-26 19:27:44

Rogasiek

http://i37.tinypic.com/okc0lk.gif

Zarejestrowany: 2008-05-20
Posty: 4

Skrypt na npc który sprzedaje pacc i promotion.

Witam!

Mam prośbę czy ktoś z Was forumowiczów mógłby mi podesłać gotowe skrypty na npc który sprzedaje pacca i promocję. Powiedzmy pacc na 7dni za 5cc w języku angielskim. Chodzi mi o skrypt do tibi 8.6 z gry dziękuje za pomoc.

Offline

 

#2 2012-06-27 23:19:11

Rogasiek

http://i37.tinypic.com/okc0lk.gif

Zarejestrowany: 2008-05-20
Posty: 4

Re: Skrypt na npc który sprzedaje pacc i promotion.

Może mi ktoś powiedzieć co jest źle w tym kodzie? Npc się pojawia lecz nie reaguje na polecenie kupna np: jak pyta na ile dni pacc opisuje 7 itp a on nic tak samo z promocją. Co poszło nie tak?

A o to kod:

data/npc/Premmy.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Premium" script="data/npc/scripts/promotion.lua" autowalk="1" floorchange="0">
    <health now="100" max="100"/>
    <look type="153" head="77" body="119" legs="0" feet="0" addons="1"/>
    <parameters>
        <parameter key="message_greet" value="|PLAYERNAME| I can sell you Premiums and Promotions"/>
        <parameter key="message_needmoremoney" value="You do not have enough money."/>
        <parameter key="message_decline" value="Maybe next time?"/>
    </parameters>
</npc>

add it in the end (go to one enter) data/npc/lib/npcsystem/modules.lua

function StdModule.premiumPlayer(cid, message, keywords, parameters, node)
    local npcHandler = parameters.npcHandler
    if(npcHandler == nil) then
        error('StdModule.promotePlayer called without any npcHandler instance.')
    end
    if(cid ~= npcHandler.focus) then
            return false
    end
    if getPlayerPremiumDays(cid) <= 350 then
        if(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
            npcHandler:say('You do not have enough money!')
        elseif parameters.cost == 5000 then
            doPlayerAddPremiumDays(cid, 7)
            npcHandler:say(parameters.text)
        elseif parameters.cost == 20000 then
            doPlayerAddPremiumDays(cid, 30)
            npcHandler:say(parameters.text)
        elseif parameters.cost == 35000 then
            doPlayerAddPremiumDays(cid, 60)
            npcHandler:say(parameters.text)
        elseif parameters.cost == 55000 then
            doPlayerAddPremiumDays(cid, 90)
            npcHandler:say(parameters.text)
        end
    else
        npcHandler:say("I am sorry but I can't sell you any more premiums.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
    return true
end

data/npc/scripts/promotion.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 node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Allright then. Come back when you are ready.', reset = true})
local node2 = keywordHandler:addKeyword({'premium'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'How many days of premium do you want to buy? I offer 7 days for 5k, 30 days for 20k, 60 days for 35k, and 90 days for 55k.'})
    node2:addChildKeyword({'7'}, StdModule.premiumPlayer, {npcHandler = npcHandler, cost = 5000, text = 'You now have 7 more days of premium'})
    node2:addChildKeyword({'30'}, StdModule.premiumPlayer, {npcHandler = npcHandler, cost = 20000, text = 'You now have 30 more days of premium'})
    node2:addChildKeyword({'60'}, StdModule.premiumPlayer, {npcHandler = npcHandler, cost = 35000, text = 'You now have 60 more days of premium'})
    node2:addChildKeyword({'90'}, StdModule.premiumPlayer, {npcHandler = npcHandler, cost = 55000, text = 'You now have 90 more days of premium'})
npcHandler:addModule(FocusModule:new())

Offline

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
usuwanie adblue legowisko ortopedyczne dla kota