Forum

> > CS2D > Scripts > Different menu for two teams
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Different menu for two teams

1 Antwort
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Different menu for two teams

OutstandingPP
BANNED Off Offline

Zitieren
i just want to make menu
you don't have to do anything but i get error
i want if player was terrorist and he pressed f2 he get different menu than counter-terrorist menu if he pressed f2

hope you understood me

1
2
3
4
5
6
7
8
9
10
11
addhook("serveraction" , "sa")
function sa(id,action)
	if action==1 then 
	if team==1 then
	menu(id,"Main Menu,exe")
	else
	if team==2 then
	menu(id,"Main Menu,exeeee")
	end
end
end

is this correct ?
if no
send for me the code in comments
Do not mock me because I tyro

alt Re: Different menu for two teams

GeoB99
Moderator Off Offline

Zitieren
"menu" is kinda generic, I changed the thread title to a better one.
As for the code, this is how you should do:
1
2
3
4
5
6
7
8
9
10
11
function PlayerTeamMenu(id, action)
	if ( action == 1 ) then
		if ( player(id, 'team') == 1 ) then
			menu(id, 'Menu, ..., ..., ...')
		elseif ( player(id, 'team') == 2 ) then
			menu(id, 'Menu, ..., ..., ...')
		end
	end
end

addhook('serveraction', 'PlayerTeamMenu')
As per the cs2d lua cmd player Lua function (check the documentation below the Info title). Your problem was
team
didn't have any value what-so-ever and CS2D doesn't know what exactly do you want to achieve. Use the cs2d lua cmd player function to get the player's team by creating an IF condition like above.

P.S: You must really fix your code indentation style. Read this wiki for further information on how you tab a Lua code properly.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht