• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

HELP! GOD and GM - Participating in the Lottery System.

nilvagner

Long live the otland.net
Joined
May 3, 2010
Messages
118
Reaction score
3
Location
Brazil
Guys I'm here again to ask for help you guys that delicacy of the product.

Can anyone here giving me a script for my GOD and my GM's do not participate in the lottery system.

My current file is this:


<?xml version="1.0" encoding="UTF-8"?>
<mod name="Lottery" enabled="yes">
<config name="lottery_config"><![CDATA[
t = {
lottery_hour = "1 hours", -- Time to next lottery (you set the real time on interval, it's only for the broadcast message.)
rewards_id = {2160, 2195, 2534, 2173}, -- ID's of rewards
stackable_amount = 10, -- amount, if this it's a stackable item
website = true -- Do you have `lottery` table in your database?
}
]]></config>
<globalevent name="lottery" interval="600000" event="buffer"><![CDATA[
domodlib('lottery_config')
local list = getPlayersOnline()
if #list > 0 then
local winner, item = list[math.random(#list)], t.rewards_id[math.random(#t.rewards_id)]
local stackable = getItemInfo(item).stackable
doPlayerAddItem(winner, item, stackable and t.stackable_amount or 1)
doBroadcastMessage('[SYSTEM LOTTERY]\nWinner: '.. getCreatureName(winner) ..',\nPremio: '.. (stackable and t.stackable_amount ..' ' or '') .. (stackable and getItemInfo(item).plural or getItemNameById(item)) .. '.\nCongratulations!\n(Next lottery in '.. t.lottery_hour ..')')
if t.website then
db.executeQuery("INSERT INTO `lottery` (`name`, `item`, `world_id`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(item) .."', '".. getConfigValue('worldId') .."');")
end
end
return true
]]></globalevent>
</mod>
 
XML:
<?xml version="1.0" encoding="UTF-8"?>
	<mod name="Lottery" enabled="yes">
	<config name="lottery_config"><![CDATA[
		t = {
			lottery_hour = "1 hours", -- Time to next lottery (you set the real time on interval, it's only for the broadcast message.)
			rewards_id = {2160, 2195, 2534, 2173}, -- ID's of rewards
			stackable_amount = 10, -- amount, if this it's a stackable item
			website = true -- Do you have `lottery` table in your database?
		}
	]]></config>
	<globalevent name="lottery" interval="600000" event="buffer"><![CDATA[
		domodlib('lottery_config')
		local list = getPlayersOnline()
		for i = 1, #list do
			if getPlayerAccess(list[i]) > 1 then
				table.remove(list, i)
			end
		end
		if #list > 0 then
			local winner, item = list[math.random(#list)], t.rewards_id[math.random(#t.rewards_id)]
			local stackable = getItemInfo(item).stackable
			doPlayerAddItem(winner, item, stackable and t.stackable_amount or 1)
			doBroadcastMessage('[SYSTEM LOTTERY]\nWinner: '.. getCreatureName(winner) ..',\nPremio: '.. (stackable and t.stackable_amount ..' ' or '') .. (stackable and getItemInfo(item).plural or getItemNameById(item)) .. '.\nCongratulations!\n(Next lottery in '.. t.lottery_hour ..')')
			if t.website then
				db.executeQuery("INSERT INTO `lottery` (`name`, `item`, `world_id`) VALUES ('".. getCreatureName(winner) .."', '".. getItemNameById(item) .."', '".. getConfigValue('worldId') .."');")
			end
		end
		return true
	]]></globalevent>
</mod>
 
I want to ask one more favor if possible of course! I need a script for when the player talk to an NPC so it can be teleported if you have the following addons full: Brotherhood or Nightmare. So they are thrown into the room where poderam choose between one of two shields.

Could you help me?
 
I want to ask one more favor if possible of course! I need a script for when the player talk to an NPC so it can be teleported if you have the following addons full: Brotherhood or Nightmare. So they are thrown into the room where poderam choose between one of two shields.

Could you help me?

Uhm, something like this?

Npcname.xml

XML:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="YOURNPCNAME" script="data/npc/scripts/YOURFILE.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="129" head="79" body="113" legs="105" feet="86" addons="0"/>
        <parameters>
                <parameter key="message_greet" value="Hello |PLAYERNAME|, ask me for a {teleport} if you'd like one!"/>
                <parameter key="message_farewell" value="Good bye |PLAYERNAME|, come back soon!."/>
 
    </parameters>
 
</npc>

YOURFILE.lua
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

function creatureSayCallback(cid, type, msg)
if msgcontains(msg, 'teleport') and getCreatureOutfit(cid) == 17 or getCreatureOutfit(cid) == 19 then
   npcHandler:say('There you go!', cid)
   doTeleportThing(cid,{x=EDIT, y=EDIT, z=EDIT})
elseif msgcontains(msg, 'teleport') and getCreatureOutfit(cid) ~= 17 or getCreatureOutfit(cid) ~= 19 then
       npcHandler:say('You do not have the required outfits to ask me that', cid)
       end
return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Good Night!

I'll explain my plan for this command. I need a command to teleport the player into a room where he can choose one between the two shells. But for that it must have done the full outfit of one or two legions Brotherhood Nightmare.

Here the number of storagens: 10037 and 10038. The player who is already with these estoragens will talk to the NPC and will be released into a room where you can choose one of the shells.

Thanks everyone, and pardon the bad English.
 
Ok, so assumming I understood you, you must have 1 of the 2 storages (10037 or 10038) to choose.
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
 
function creatureSayCallback(cid, type, msg)
if (msgcontains(msg, 'teleport')) and getPlayerStorageValue(cid,10037) == 1 or getPlayerStorageValue(cid, 10038) == 1 then
   npcHandler:say('There you go!', cid)
   doTeleportThing(cid,{x=EDIT, y=EDIT, z=EDIT})
elseif msgcontains(msg, 'teleport') and getPlayerStorageValue(cid,10037) == -1 or getPlayerStorageValue(cid,10038) == -1 then
       npcHandler:say('You are not allowed to get teleported.', cid)
       end
return true
end
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

IF you need 2 storages, then just put "and" instead of "or" ;)
 
I want to ask one more favor if possible of course! I need a script for when the player talk to an NPC so it can be teleported if you have the following addons full: Brotherhood or Nightmare. So they are thrown into the room where poderam choose between one of two shields.

Could you help me?
Not is more easy that when have those addon can get one of two shield instead teleport to get it? :P
 
Back
Top