• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Promotion with talk action?

nystrom

New Member
Joined
Nov 17, 2009
Messages
269
Reaction score
0
hello i need help with converting my npc promotion script to a script that works so ppls just can say !promotion;!buypromotion.

this is my npc script that i am using:
PHP:
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({'promot'}, 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, promotion = 1, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
	node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
	node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--

npcHandler:addModule(FocusModule:new())

Does some one have this script for talkactions? it would be awsome :D
 
Lua:
function onSay(cid, words, param, channel)
	local cost = {firstP = 100*100*2, secondP = 100*100*20}
	local enable_2nd_promotion = false
	local storage = 130
		if(getPlayerPromotionLevel(cid) == 0) then
			if(getPlayerStorageValue(cid, storage) < 0) then
				if(pay(cid,cost.firstP)) then
					setPlayerStorageValue(cid, storage, 1)
					doPlayerSetPromotionLevel(cid, 1)
				else
					doPlayerSendCancel(cid, "Sorry, not enough money.")
				end
			end
		elseif(getPlayerPromotionLevel(cid) == 1) then
			if(enable_2nd_promotion) then
				if(getPlayerStorageValue(cid, storage) == 1) then
					if(pay(cid, cost.secondP)) then
						setPlayerStorageValue(cid, storage, 2)
						setPlayerStorageValue(cid, storage, 1)
						doPlayerSetPromotionLevel(cid, 1)
					else
						doPlayerSendCancel(cid, "Sorry, not enough money.")
					end
				end
			end
		end
	return true
end
 
Back
Top Bottom