Forum

> > CS2D > Scripts > 1 button 2 different functions
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch 1 button 2 different functions

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt 1 button 2 different functions

DX
User Off Offline

Zitieren
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 >
3× editiert, zuletzt 02.11.20 13:36:27

alt Re: 1 button 2 different functions

Bowlinghead
User Off Offline

Zitieren
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

alt Re: 1 button 2 different functions

DX
User Off Offline

Zitieren
@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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht