Jump to content

[ Dead Download Link ] [Release]Gift system(Updated: 3.july.2014) [ We Need You ]


Zetsu

Recommended Posts

How i can change it to get a gift after X hour online? And for me isnt working the "hide". I click on box get the gift and it still there i try too the LSHIFT + P but didnt work

 

Follow the instructions. I left some comment lines in quest. They should show you what to do if you want some edits.

 

And about cient side... Be careful where did you add these functions.

If you need some help add skype ID: ***

  • Love 1
Link to comment
Share on other sites

How i can change it to get a gift after X hour online? And for me isnt working the "hide". I click on box get the gift and it still there i try too the LSHIFT + P but didnt work

 

Check this:

-- © 2014 Zetsu - This system it's made by me for metin2Dev.org
-- Thanks:
-- THS Dev Team
-- Invictus for some changes
-- Do not change Copyrights or re-post on another stupid forums!
quest thsgiftdev begin
    state start begin
        when logout begin
            pc.setqf("giftsystemuse", 0)
        end
        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
            if pc.getqf("giftsystemuse") ~= 0 then
                if pc.getqf("giftsystemuse") <= get_time() then
                    thsgiftdev.giverandomitem()
                end
            end
            if pc.getqf("giftsystemuse") == 0 then
                local hours = 2
                pc.setqf("giftsystemuse", get_time()+60*60*hours)
            end
        end
         
        function giverandomitem()
            local random_nr = number(1,5)
            local hours = 2
            chat("I: The box it's opening...") -- Opening
            if random_nr==1 then
                pc.give_item2(tonumber(mysql_query('SELECT box1 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box1[1]))
            elseif random_nr==2 then
                pc.give_item2(tonumber(mysql_query('SELECT box2 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box2[1]))
            elseif random_nr==3 then
                pc.give_item2(tonumber(mysql_query('SELECT box3 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box3[1]))
            elseif random_nr==4 then
                pc.give_item2(tonumber(mysql_query('SELECT box4 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box4[1]))
            elseif random_nr==5 then
                pc.give_item2(tonumber(mysql_query('SELECT box5 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box5[1]))
            end
            pc.setqf("giftsystemuse", get_time()+60*60*hours)
            cmdchat("giftsyshide")
        end
 
        when button or info begin
            if pc.getqf("giftsystemuse") ~= 0 then
                if pc.getqf("giftsystemuse") <= get_time() then
                    thsgiftdev.giverandomitem() -- yeah..function  don't try to bind that condition with this..
                else
                    chat("W: You have no gift. Try after 12 hours...") -- Played
                end
            end
            if pc.getqf("giftsystemuse") == 0 then
                local hours = 2
                pc.setqf("giftsystemuse", get_time()+60*60*hours)
            end            
        end
    end
end

I have added new variable named hours and you can change the hour there.

If I understand right you want the player to receive the gift after 1 hour online for example,so I made the quest when you're logging out the time is set to 0 and you can't open it.

 

I didn't have much time to made it, so this may not work properly

  • Love 3
Link to comment
Share on other sites

Thanks Zetsu. Alrdy add you

 

 

How i can change it to get a gift after X hour online? And for me isnt working the "hide". I click on box get the gift and it still there i try too the LSHIFT + P but didnt work

 

Check this:

-- © 2014 Zetsu - This system it's made by me for metin2Dev.org
-- Thanks:
-- THS Dev Team
-- Invictus for some changes
-- Do not change Copyrights or re-post on another stupid forums!
quest thsgiftdev begin
    state start begin
        when logout begin
            pc.setqf("giftsystemuse", 0)
        end
        when login begin
            cmdchat("zetsugfsys "..q.getcurrentquestindex())
            if pc.getqf("giftsystemuse") ~= 0 then
                if pc.getqf("giftsystemuse") <= get_time() then
                    thsgiftdev.giverandomitem()
                end
            end
            if pc.getqf("giftsystemuse") == 0 then
                local hours = 2
                pc.setqf("giftsystemuse", get_time()+60*60*hours)
            end
        end
         
        function giverandomitem()
            local random_nr = number(1,5)
            local hours = 2
            chat("I: The box it's opening...") -- Opening
            if random_nr==1 then
                pc.give_item2(tonumber(mysql_query('SELECT box1 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box1[1]))
            elseif random_nr==2 then
                pc.give_item2(tonumber(mysql_query('SELECT box2 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box2[1]))
            elseif random_nr==3 then
                pc.give_item2(tonumber(mysql_query('SELECT box3 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box3[1]))
            elseif random_nr==4 then
                pc.give_item2(tonumber(mysql_query('SELECT box4 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box4[1]))
            elseif random_nr==5 then
                pc.give_item2(tonumber(mysql_query('SELECT box5 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box5[1]))
            end
            pc.setqf("giftsystemuse", get_time()+60*60*hours)
            cmdchat("giftsyshide")
        end
 
        when button or info begin
            if pc.getqf("giftsystemuse") ~= 0 then
                if pc.getqf("giftsystemuse") <= get_time() then
                    thsgiftdev.giverandomitem() -- yeah..function  don't try to bind that condition with this..
                else
                    chat("W: You have no gift. Try after 12 hours...") -- Played
                end
            end
            if pc.getqf("giftsystemuse") == 0 then
                local hours = 2
                pc.setqf("giftsystemuse", get_time()+60*60*hours)
            end            
        end
    end
end

I have added new variable named hours and you can change the hour there.

If I understand right you want the player to receive the gift after 1 hour online for example,so I made the quest when you're logging out the time is set to 0 and you can't open it.

 

I didn't have much time to made it, so this may not work properly

 

 

Thanks i will take a look how u did and add to the quest from kingtsunami. I'm using this quest rnow.

 

quest thsgiftdev begin
	state start begin  
		when login begin
			cmdchat("zetsugfsys "..q.getcurrentquestindex())
		end
		  
		function giverandomitem()
			local ids = number(1,5)
			local items = {
			--	number_id vnum count size
				[1] = {279,1,2},
				[2] = {19,1,2},
				[3] = {299,1,2},
				[4] = {169,1,2},
				[5] = {159,1,2},
			 
			}
			if pc.get_empty_inventory_count() >= items[ids][3] then
				pc.give_item2(items[ids][1],items[ids][2])
				pc.setqf("giftsystemuse", get_time()+60*60*12)
				cmdchat("giftsyshide")
			else
				syschat("You don't have enough space.")
			end
		end
		when button or info begin
			if pc.get_level() >= 105 then
				if pc.getqf("giftsystemuse") <= get_time() then
					thsgiftdev.giverandomitem()
				else
					syschat("You can open the box every 12 hours,please be patient.")
				end
			else
				syschat("You will need to be level 105 to open the giftbox.")
			end
		end
	end
end


 

Link to comment
Share on other sites

 

i have this error and when i open ther note hide ther show every time

https://metin2.download/picture/xZ8REsC2kOd9P5r2Av1NI6ZPWjq4CFnh/.png

You don't have a function added. Respect the tutorial and don't change anything

 

 

what i put all things the same way ther i see here in topic 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Hello everybody

 

Today I will show my new system - I decided to release it...It's a very simple system and useful for PServers.

 

What does it do? Well, it gives a random item to a player at every 12 hrs. He must enter the game and click on a gift to get the item. GM can set 5 items in DB and one of them will be gived to the players.

16j0dxi.jpg

You can change time for this system 

e.g.:

 

 

kd04r8.jpg

 

 

Items ID are stored in a new table called "surprisebox".

 

Server_side:

FirstReq: If somebody wants to add new conditions to quest, first ask me in pm, then post here. Probably some people would think that it's my mistake...Thanks for understanding!

You must run this query to install:

CREATE TABLE `surprisebox` (
`id`  int(5) NOT NULL AUTO_INCREMENT ,
`openorclose`  int(5) NOT NULL ,
`box1`  int(8) NULL DEFAULT NULL ,
`box2`  int(8) NULL DEFAULT NULL ,
`box3`  int(8) NULL DEFAULT NULL ,
`box4`  int(8) NULL DEFAULT NULL ,
`box5`  int(8) NULL DEFAULT NULL ,
`date`  varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
`hour`  varchar(20) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL ,
PRIMARY KEY (`id`)
)
ENGINE=MyISAM
DEFAULT CHARACTER SET=latin1 COLLATE=latin1_swedish_ci
AUTO_INCREMENT=47
CHECKSUM=0
ROW_FORMAT=DYNAMIC
DELAY_KEY_WRITE=0
;

Then run this:

INSERT INTO `surprisebox` (`openorclose`,`box1`,`box2`,`box3`,`box4`,`box5`,`date`,`hour`) VALUES (1, ITEM_ID_1, ITEM_ID_2, ITEM_ID_3, ITEM_ID_4, ITEM_ID_5, '<date>', '<hour>');

This is just an example. You must have one row with column openorclose=1 , in rests 0 (that if you have more saved).

 

Now you have to install the quest. Also, i made this system possible to be edited by anybody, so you can modify the codes..

thsgiftdev.quest

 

DO NOT rename the quest. You must install it with name: thsgiftdev.quest or it doesn't work. If you renamed it i'll not help you. Good luck!

-- (c) 2014 Zetsu - This system it's made by me for metin2Dev.org
-- Thanks:
-- THS Dev Team 
-- Invictus for some changes
-- Do not change Copyrights or re-post on another stupid forums!
quest thsgiftdev begin
	state start begin
		when login begin
			cmdchat("zetsugfsys "..q.getcurrentquestindex())
		end
		
		function giverandomitem()
			local random_nr = number(1,5)
			chat("I: The box it's opening...") -- Opening 
			if random_nr==1 then
				pc.give_item2(tonumber(mysql_query('SELECT box1 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box1[1]))
			elseif random_nr==2 then
				pc.give_item2(tonumber(mysql_query('SELECT box2 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box2[1]))
			elseif random_nr==3 then
				pc.give_item2(tonumber(mysql_query('SELECT box3 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box3[1]))
			elseif random_nr==4 then
				pc.give_item2(tonumber(mysql_query('SELECT box4 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box4[1]))
			elseif random_nr==5 then
				pc.give_item2(tonumber(mysql_query('SELECT box5 from player.surprisebox WHERE openorclose=1 LIMIT 1;').box5[1]))
			end
			pc.setqf("giftsystemuse", get_time()+60*60*12) -- 12 HRS  
            cmdchat("giftsyshide")
		end

		when button or info begin
			if pc.getqf("giftsystemuse") <= get_time() then
				thsgiftdev.giverandomitem() -- yeah..function  don't try to bind that condition with this..
			else
				chat("W: You have no gift. Try after 12 hours...") -- Played 
			end
		end 
	end
end

Edit:

If you want to show the box when the event it's running add under cmdchat("zetsugfsys "..q.getcurrentquestindex())

if tonumber(mysql_query('SELECT openorclose from player.surprisebox WHERE id>0 LIMIT 1;').openorclose[1]) != 0 then
	cmdchat("giftsysshow")
else
	cmdchat("giftsyshide")
end

Download full: https://mega.co.nz/#!iZQiUbqY!VEULcrJ6set30fFQkkCRlD71U3Dvy-TjULhcIICC1JM

Client_side:

Be careful! Forum replace a blank by Tab button with spaces! Be careful at syntax.

 

 

Open game.py(root) and search:

self.playerGauge = None

Under this add:

		## Z ##############################################################################
		self.GiftBox = ui.Button()
		self.GiftBox.SetUpVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetOverVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetDownVisual("d:/ymir work/ui/present.tga")
		self.GiftBox.SetText("?")
		self.GiftBox.SetToolTipText("Open the box!")
		self.GiftBox.SetPosition(10, int(wndMgr.GetScreenHeight())-126)
		self.GiftBox.SetEvent(self.ZetsuGiftSystem__deff__)
		self.GiftBox.Show()
		## Z ##############################################################################

=================================================================================================

Search:

def OnUpdate(self):

Under this, add:

## Z ##############################################################################
		if app.IsPressed(app.DIK_P) and app.IsPressed(app.DIK_LSHIFT):
			if self.GiftBox.IsShow():
				self.GiftBox.Hide()
			else:
				self.GiftBox.Show()
		## Z ##############################################################################

or added to this function. Picture:

 

pzO5P.jpg

 

Now search

	def __ServerCommand_Build(self):
		serverCommandList={

And add:

			## Begin LuckyBoxes system by Zetsu
			"zetsugfsys"                            : self.ZetsuGiftSystem__init__,
            "giftsysshow" : self.ZetsuGiftSystem__show__,
            "giftsyshide" : self.ZetsuGiftSystem__hide__,
			## End LuckyBoxes

Picture:

5CGmp.jpg

 

Do NOT add:

            "giftsyspop" : self.ZetsuGiftSystem__prnt__,

My mistake...

 

Now, the last thing it's to add the function at the end:

## Begin LuckyBoxes system by Zetsu
	def ZetsuGiftSystem__init__(self, index):	
		constInfo.GIFTSYS = index # if doesn't work replace with:   constInfo.GIFTSYS = int(index) # But it's impossible...
	def ZetsuGiftSystem__deff__(self):
		import event
		event.QuestButtonClick(int(constInfo.GIFTSYS))
	## End LuckyBoxes
	# Warning!! Let the last row empty!! ##
    def ZetsuGiftSystem__show__(self):
        self.GiftBox.Show()
    def ZetsuGiftSystem__hide__(self):
        self.GiftBox.Hide()

Picture:

DCPcf.jpgWarning! If you add this at the end of game.py, the last line must be empty!

 

Now open constinfo.py and add at the beginning of the file:

GIFTSYS = 1 

 

#####New: GS-Tool#####

MeZk7.jpg

Don't add this PHP Cpannel to your website. Use a free domain or localhost.

Config CPannel from dbCOnf.php also replace

$dbname = "zetsusystems";

With

 

$dbname = "player";

 

 

Download the button: mega.co.nz - Add it in: (Etc.epk/eix)D:/ymir work/ui

Download PHP-CPannel: mega.co.nz

 

 

 

Kind regards,

Zetsu

I offer support, just ask me here or in PM! Soon I will add PHP_CPannel for beginners.

I know this system it's very simple and contains some parts where i choose the hard way, but anyway.. i think this system keeps players online.

 

Note: If you want to hide the Box press: LShift+P

Sometimes it's annoying xD ...

 

great release ^^

thanks

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 1
Link to comment
Share on other sites



0605 17:18:26398 :: CMapOutdoor::Load - LoadMonsterAreaInfo ERROR
0605 17:18:28072 :: GRANNY: r:/granny/rt/granny_file_info.cpp(145): File has run-time type tag of 0x8000000f, which doesn't match this version of Granny (0x80000010).  Automatic conversion will be attempted.
0605 17:18:36121 :: Traceback (most recent call last):

0605 17:18:36122 ::   File "networkModule.py", line 231, in SetGamePhase

0605 17:18:36122 ::   File "system.py", line 130, in __pack_import

0605 17:18:36122 ::   File "
0605 17:18:36122 :: <string>
0605 17:18:36122 :: ", line 
0605 17:18:36122 :: 107
0605 17:18:36122 :: 

0605 17:18:36122 ::     
0605 17:18:36122 :: self.stream=stream

0605 17:18:36122 ::     
0605 17:18:36122 :: ^

0605 17:18:36128 :: SyntaxError
0605 17:18:36128 :: : 
0605 17:18:36128 :: invalid syntax
0605 17:18:36128 :: 

hii man wow its rly make u lose ur mind :D

 

 

but I have some proplem I hope u can fix it :(

 

 

my syserr:

 

Link to comment
Share on other sites



0605 17:18:26398 :: CMapOutdoor::Load - LoadMonsterAreaInfo ERROR
0605 17:18:28072 :: GRANNY: r:/granny/rt/granny_file_info.cpp(145): File has run-time type tag of 0x8000000f, which doesn't match this version of Granny (0x80000010).  Automatic conversion will be attempted.
0605 17:18:36121 :: Traceback (most recent call last):

0605 17:18:36122 ::   File "networkModule.py", line 231, in SetGamePhase

0605 17:18:36122 ::   File "system.py", line 130, in __pack_import

0605 17:18:36122 ::   File "
0605 17:18:36122 :: <string>
0605 17:18:36122 :: ", line 
0605 17:18:36122 :: 107
0605 17:18:36122 :: 

0605 17:18:36122 ::     
0605 17:18:36122 :: self.stream=stream

0605 17:18:36122 ::     
0605 17:18:36122 :: ^

0605 17:18:36128 :: SyntaxError
0605 17:18:36128 :: : 
0605 17:18:36128 :: invalid syntax
0605 17:18:36128 :: 

hii man wow its rly make u lose ur mind :D

 

 

but I have some proplem I hope u can fix it :(

 

 

my syserr:

 

 

I need your game.py in private.

Link to comment
Share on other sites

Update 13.june.2014 - Take it now! It's still hot.

 

I decided to add Gift box item!  :D

About it:

Vnum: 17609

Use from level: 10

Can be used for: infinite times (you decide that)

Can: -

Can't: be stored, traded, sold.

Icon: 2iuoxld.gif2sbu2ix.jpg

 

New quest update:

 

Go to first page and take from there!

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.