Forum

> > CS2D > Scripts > So I've been trying to add more Add-ons...
Forums overviewCS2D overview Scripts overviewLog in to reply

English So I've been trying to add more Add-ons...

11 replies
To the start Previous 1 Next To the start

old So I've been trying to add more Add-ons...

Mami Tomoe
User Off Offline

Quote
First thing, I spent almost weeks trying to figure out how this script works but for no use, all I got is a next button that is working but... I couldn't find a way to show the next add-ons using it.
I searched all over unreal software and didn't found anything helpful...

I just wanted to tell you that this script is complicated...
Anyways if you wish to volunteer at helping me I can put you in my server credits afterword's. (if you wish of course)

addons.lua >


Some stuff I found in hooks.lua >

old Re: So I've been trying to add more Add-ons...

Nekomata
User Off Offline

Quote
Elaborate. What do you mean by wanting to add addons? You need to clearly state what how you want something to be so if someone wishes to help they'd exactly understand what you mean.

Do you want more menu items? More commands? More user attributes? You need to elaborate.

old Re: So I've been trying to add more Add-ons...

tontonEd
User Off Offline

Quote
to add more hat you have to respect the Addons array structure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
No = ,
          FName      = ,
          FPrice  = ,
          r = ,
	 g = ,
	 b = ,
         FIMGBlend=, 
         FIMGAlpha=,
          FOnTop  = ,
          FSpeed  = ,
          health  = ,
          wpn          = ,
          FLic = Array(32, 0),
          FHave= Array(32, 0),
          FImage     = "",
          FImageVIP = "",
          FVIPOnTop     =,


but what's your problem, you want to add more hat ? got a bug ?

the code works like this :

1 - In menu hook
2 - CreateAddonsMenu(id) (that's what you want to work on right ?)
3- menu with all the hat

and then you didn't post the code, search in hooks.lua :
1
if men == "Enable/Disable Add-on" then

old Re: So I've been trying to add more Add-ons...

MikuAuahDark
User Off Offline

Quote
As far as I know, it only support up to 9 addons(because cs2d lua cmd menu only able to list 9 selections at once), but, let's get back to 2013, where Rajagame server has 16 addons(and it can support unlimited amount of addons). It doesn't simple as adding new text(addons) into the structure because it only support up to 9. In order to add more than 9 addons, you need to create UniMenu in the Addons menu.

Anyway, here's the Addons script that I coded for Rajagame before(luckily I still have it in my hard drive)
Addons.lua. Append it because I don't copy the addons data >


In Main.lua(Array initialization)
1
Page=Array(32,1)

Somewhere in the menu hook >


Make sure to backup the affected files first. In case if there's error that you can't fix, you can simply restore it

old Re: So I've been trying to add more Add-ons...

Mami Tomoe
User Off Offline

Quote
@user MikuAuahDark:
1
2
3
4
LUA ERROR: sys/lua/IF/sys/addons.lua:256: attempt to call global 'AddonsCheck' (a nil value)
 -> sys/lua/IF/sys/addons.lua:256: in function 'CreateAddonsSell'
 -> sys/lua/IF/sys/hooks.lua:1187: in function <sys/lua/IF/sys/hooks.lua:418>
 -> in Lua hook 'menu', params: 1, 'Buy', 2

I think I'm missing something related to the function for the addonscheck...

Edit: Never mind I found a way around it, thank you so much


Edit:
Also I have a small problem with the menu,

Example: I spawned and selected a hat addon on the second page and the page closed, when I go back to the page it will stay on page 2 but will show page 1 content...

Is there a way to make the page be 1 by default?
edited 2×, last 05.10.15 01:17:33 am

old Re: So I've been trying to add more Add-ons...

MikuAuahDark
User Off Offline

Quote
Upps, forgot to copy the AddonsCheck function. Here you go
AddonsCheck. Put in Addons.lua >


user Mami Tomoe has written
Is there a way to make the page be 1 by default?

Well, without knowing the complete cs2d lua hook menu hook code, it may hard to know where to put Page[id]=1 which set it back to Page 1.

old Re: So I've been trying to add more Add-ons...

Mami Tomoe
User Off Offline

Quote
user MikuAuahDark has written
user Mami Tomoe has written
Is there a way to make the page be 1 by default?

Well, without knowing the complete cs2d lua hook menu hook code, it may hard to know where to put Page[id]=1 which set it back to Page 1.


The code works =D
but I have a question, how to give you hook for menu?
give me example how it looks like..
is it like
1
menu(id,"...,...,...,..")
or
1
2
3
4
5
if men == "..."
if sel == 1 then
...
end
end
?

old Re: So I've been trying to add more Add-ons...

GeoB99
Moderator Off Offline

Quote
1
menu(id,"...,...,...,..")
With this line, you're only create a menu with a title and name of the buttons. This menu is useless because you don't have a menu code hook to make this piece of menu to work.
Let's say for example:
1
2
3
4
5
6
7
8
addhook("menu","Mymenu")
function Mymenu(id, title, button)
	if title == "The first menu" then
		if button == 1 then
			thesecondmenu(id)
		end
	end
end
This is only a little example. Basically if I press the first button, it'll change the page to another menu (which is thesecondmenu(id)). thesecondmenu(id) comes from a function which basically has the menu like in the line that I posted above. You have to make the menu functions for yourself. I think, you know what I mean.

P.S: The menu hook code looks like the second code in your last post.

I hope, this is what you're meaning.

old Re: So I've been trying to add more Add-ons...

Mami Tomoe
User Off Offline

Quote
user GeoB99 has written
1
2
3
4
5
6
7
8
addhook("menu","Mymenu")
function Mymenu(id, title, button)
	if title == "The first menu" then
		if button == 1 then
			thesecondmenu(id)
		end
	end
end


You can also do:

1
2
3
4
5
6
7
8
addhook("menu","Mymenu")
function Mymenu(id, title, button)
	if title == "The first menu" then
		if button == 1 then
			menu(id,"1,2,3,4,5,6,7,8,9")
		end
	end
end

To skip the function, but the function is better if you need to use the menu a lot.



@user MikuAuahDark:
Is that what you need?
More >
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview