Forum

> > CS2D > Scripts > Open menu by command
Forums overviewCS2D overview Scripts overviewLog in to reply

English Open menu by command

30 replies
Page
To the start Previous 1 2 Next To the start

old Open menu by command

Marcell
Super User Off Offline

Quote
Welcome!

I'would like to know how can i do that when i type !menu to chat that open a menu
like that i wanna use Engineer's Doctor Who script on my pc, but i use admin script already.. how can i change it to not open by serveraction buttons, otherwise open it by say like !tardis

old Re: Open menu by command

Mora
User Playing CS2D

Quote
mm i have one,maybe it?:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("say","said")
addhook("menu","m")

function said(id,text)
     if text=="!menu" then
menu(id,"Test Menu,Equip M4A1,Machete,Snowballs")
     end
end

function m(id,title,b)
     if title=="Test Menu" then
 if b==1 then
parse("equip "..id.." 32")
 elseif b==2 then
parse("equip "..id.." 69")
 elseif b==3 then
parse("equip "..id.." 75")
     end
 end
end

old Re: Open menu by command

Varna97
User Off Offline

Quote
user Mora has written
mm i have one,maybe it?:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("say","said")
addhook("menu","m")

function said(id,text)
     if text=="!menu" then
menu(id,"Test Menu,Equip M4A1,Machete,Snowballs")
     end
end

function m(id,title,b)
     if title=="Test Menu" then
 if b==1 then
parse("equip "..id.." 32")
 elseif b==2 then
parse("equip "..id.." 69")
 elseif b==3 then
parse("equip "..id.." 75")
     end
 end
end


Wrong ×

function m(id)
if title=="Weapons" then
if b==1 then
parse("equip "..id.." 32")
elseif b==2 then
parse("equip "..id.." 69")
elseif b==3 then
parse("equip "..id.." 75")
end
end

old Re: Open menu by command

Mora
User Playing CS2D

Quote
@user Varna97: you test my code?yes/not?what your skills with scripts?
CS Varna d-_-b has written
function m(id)
if title=="Weapons" then
if b==1 then
parse("equip "..id.." 32")
elseif b==2 then
parse("equip "..id.." 69")
elseif b==3 then
parse("equip "..id.." 75")
end
end

here you will got error:
"Lua error: "end" it is expected near "if" at line 2"

@user Marcell: tell me if my work,please...
edited 1×, last 05.01.14 01:34:36 pm

old Re: Open menu by command

Rainoth
Moderator Off Offline

Quote
More >


BOBA Pycckuu : 1
Hacker : 0

He gave a normal script. Well... It could be tabbed but it's just reading it, it's executed properly anyway.

// How is he not banned yet ? It's so obvious that he's a hacker >.>

old Re: Open menu by command

Rainoth
Moderator Off Offline

Quote
Duhh. And it's not just "Sonic Black Knight". There's many variations of that account and they all have same facebook in them. I've already reported a lot of them but he keeps creating more accounts. I've told about it to DC and he banned most of them but here's a new one... I've been refering to him as a hacker for about two-three months but nobody cares so..

// I know that he's a hacker because he used to come to my server and hack there heh. Too bad there's no such thing as reporting in-game. Well I guess a 2D indie game doesn't need so much attention so it's all good.

old Re: Open menu by command

Marcell
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
usgn = {
r8 = {6943}; 	  -- AdminController(s)
r7 = {};          -- SuperAdmin(s)
r5 = {};          -- Admin 5 
r4 = {};          -- Admin 4
r3 = {};          -- Admin 3
r2 = {};          -- Admin 2
r1 = {};          -- Admin 1
rH = {};          -- Admin Helper(s)
rVip = {};		  -- VIP User(s)
}

function table.contains(table, element)
    for key, value in pairs(table) do
        if value == element then
            return true
        end
    end
end

	if table.contains(usgn.r8,player(id,"usgn")) then
		if team = 2 then
		return 0;
		else
		parse("maket " .. id);
		return 0;
	end
	end

wont work

old Re: Open menu by command

Marcell
Super User Off Offline

Quote
not work

1
2
3
4
5
6
7
8
9
10
if table.contains(usgn.r8,player(id,"usgn")) then
		if team = 2 then
		return 0;
		else
		if team == 2 then
		parse("maket " .. id);
		return 0;
	end
	end
end

old Re: Open menu by command

Gajos
BANNED Off Offline

Quote
user Marcell has written
not work

1
2
3
4
5
6
7
8
9
10
if table.contains(usgn.r8,player(id,"usgn")) then
		if team = 2 then
		return 0;
		else
		if team == 2 then
		parse("maket " .. id);
		return 0;
	end
	end
end

You are st*pid.

old Re: Open menu by command

Marcell
Super User Off Offline

Quote
Not really works..

If i logged in i able to join to CT team
but if i logged out already able to join to CT...

old Re: Open menu by command

sheeL
User Off Offline

Quote
You are searching for this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
addhook("team","check_me")

USGN = {
	r8 = {6943,45813};        -- AdminController(s)
	r7 = {};          -- SuperAdmin(s)
	r5 = {};          -- Admin 5 
	r4 = {};          -- Admin 4
	r3 = {};          -- Admin 3
	r2 = {};          -- Admin 2
	r1 = {};          -- Admin 1
	rH = {};          -- Admin Helper(s)
	rVip = {};            -- VIP User(s)
}

function table.contains(table, element)
    for key, value in pairs(table) do
        if value == element then
            return true
        end
    end
end

function check_me(id,team)
local USGN_id = player(id,"usgn")
	if (team==2) then
		if table.contains(USGN.r8,USGN_id) then
		return 0
	else
		parse("maket "..id);
		return 1
		end
	end
end

old Re: Open menu by command

Marcell
Super User Off Offline

Quote
why you thinkin' i will add to Admin Controller team? Maybe you helped in this script, but i will not add to for it man

Anyway still able to join to CT lol

old Re: Open menu by command

Mora
User Playing CS2D

Quote
admin = {6943,114940}

addhook("join","j")
function j(id,team)
for _, usgn in ipairs(admin) do
if player(id,"usgn")==usgn then
if team==2 then
return 1
else
parse("maket "..id)
end
end
end
end

LOL,f***g my code.

old Re: Open menu by command

Rainoth
Moderator Off Offline

Quote
user Marcell has written
Anyway still able to join to CT lol


That moment when you realize how much you've failed.
Of course you'd be able to be a CT. You're included in the table --"
I just tested Sheel's code. It's working fine.

old Re: Open menu by command

Marcell
Super User Off Offline

Quote
not work with my whole script. i tested with just this one script and it worked, but with all somewhy not

old Re: Open menu by command

Rainoth
Moderator Off Offline

Quote
I'm afraid your reply is useless. Saying "It doesn't work" won't help us in any way to solve your problem. If it works alone but not together, you might have multiple hooks/variables, maybe wrong calls. We can only suspect/assume if you don't provide us anything.
To the start Previous 1 2 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview