Forum

> > CS2D > Scripts > 1 button 2 different functions
Forums overviewCS2D overview Scripts overviewLog in to reply

English 1 button 2 different functions

3 replies
To the start Previous 1 Next To the start

old 1 button 2 different functions

DX
User Off Offline

Quote
If a terrorist presses the F2 button he will get a class menu
Spoiler >

And if ct presses the F2 button he will get a shop menu
Spoiler >
edited 3×, last 02.11.20 01:36:27 pm

old Re: 1 button 2 different functions

Bowlinghead
User Off Offline

Quote
Just look at it:
https://www.cs2d.com/help.php
Everything you need to interact with CS2D is documented there!

First: When will something happen? On the F2 button press, therefore you want to check the serveraction-hook.
1
2
addhook("serveraction","sa")
function sa(id,b)

Now, when any player presses a button, the code inside this function will be executed. Now you want to check the players team. You may use the player command for that:
1
2
3
4
5
if player(id,"team") == 1 then -- TT
-- ...
elseif (player(id,"team") == 2 then -- CT
-- ...
end

You want to open a menu? Just look at the cs2d lua cmd menu command

old Re: 1 button 2 different functions

DX
User Off Offline

Quote
@user Bowlinghead: bruh bruh bruh help me with this
Spoiler >
Make only a terrorist bot that can only get class and ct won't get anything, you know what I mean
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview