Forum

> > CS2D > Scripts > Wing mod with F4, Only for admin
Forums overviewCS2D overview Scripts overviewLog in to reply

English Wing mod with F4, Only for admin

11 replies
To the start Previous 1 Next To the start

old Re: Wing mod with F4, Only for admin

Yates
Reviewer Off Offline

Quote
I have a starter for you.

1
2
3
4
5
6
7
8
9
10
11
12
Admins = (usgn,usgn)

addhook("serveraction","amenu")
function amenu(id,act)
for _, usgn in ipairs(Admins) do
	if player(id,'usgn') == usgn then
		if act==3 then
			menu(id,"Wing Menu,Wing1,Wing2 etc..")
			return 1
		end
	end
end

This should work, untested. But it should open the menu.

1
2
3
4
5
6
7
addhook("menu","gaystuff")
function(id,title,buton)
if title=="Wing Menu" then
if buton == 1 then
end
end
end
I dunno how to add images, never tried it.
edited 1×, last 26.05.11 08:13:31 pm

old Re: Wing mod with F4, Only for admin

Homam
User Off Offline

Quote
@Yates, You forgot something on your code. Check it again.

You should replace

1
function(id,title,buton)

With:

1
function gaystuff(id,title,buton)

old Re: Wing mod with F4, Only for admin

EngiN33R
Moderator Off Offline

Quote
user Yates has written
1
2
3
4
5
6
7
8
9
10
11
12
Admins = (usgn,usgn)

addhook("serveraction","amenu")
function amenu(id,act)
for _, usgn in ipairs(Admins) do
	if player(id,'usgn') == usgn then
		if act==3 then
			menu(id,"Wing Menu,Wing1,Wing2 etc..")
			return 1
		end
	end
end


First, to make tables you have to use {}, not ().
Second, you don't have to put return 1 in a serveraction hook because it doesn't do anything.

old Re: Wing mod with F4, Only for admin

Bowlinghead
User Off Offline

Quote
If you want to have a Script and don't know how to Script then I can't help you! They give you the Script and if you don't know what you can do know then learn at first LUA! Maybe then you can Script by yourself.

Spoiler >

old Re: Wing mod with F4, Only for admin

Yasday
User Off Offline

Quote
user EngiN33R has written
Second, you don't have to put return 1 in a serveraction hook because it doesn't do anything.

He's using return to stop the for loop ( stops the function, too ). But he could've used break.

old Re: Wing mod with F4, Only for admin

EngiN33R
Moderator Off Offline

Quote
@Yates
Lua User Manual has written
You use the break statement to finish a loop. This statement breaks the inner loop (for, repeat, or while) that contains it; it cannot be used outside a loop. After the break, the program continues running from the point immediately after the broken loop.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview