Forum

> > CS2D > General > Lua Scripts for CS2D
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Lua Scripts for CS2D

134 replies
Page
To the start Previous 1 2 3 4 5 6 7 Next To the start

Poll Poll

What do you think about Lua support in CS2D?

Only registered users are allowed to vote
Awesome!
85.88% (225)
Sounds good.
7.25% (19)
Bad idea. I hate Lua!
3.44% (9)
I have no idea.
3.44% (9)
262 votes cast

old Re: Lua Scripts for CS2D

DC
Admin Off Offline

Quote
additional damage would be possible but the other things probably not because you would to have change things on the client side too there which is NOT possible.

old Re: Lua Scripts for CS2D

Kiffer-Opa
User Off Offline

Quote
just a few questions:
> Will it be possible to change the speed of a certain player?
> Will it be possible to turn FOW on/off for a certain player?
> Will it be possible to provide server-side skins (players/weapons/whatever)?
> Will it be possible to prevent CS2D from showing player information when I point with the cursor on a player?

> Will it be possible to make server-side key bindings?
This means, the client recieves key bindings from server, for instance
1
bind "B" "servercommando_xy"
so if I press the "B" key, the server executes a command (show rank information, give a weapon, etc.)
this may be more comfortable to the user as this is faster than saying "rank" or "rpgmenu" or other random chat commandos in the chat to perform a certain action.

edit:
I took the time and stored all item IDs in variables. They have almost the same name like the items ingame, just the spaces, hyphens and the plus have been removed.
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
-- item IDs
USP     	= 1;
Glock   	= 2;
Deagle		= 3;
P228		= 4;
Elite		= 5;
FiveSeven	= 6;

M3		=10;
XM1014		=11;

MP5		=20;
TMP		=21;
P90		=22;
Mac10		=23;
UMP45		=24;

Galil		=38;
Famas		=39;
AK47		=30;
M4A1		=32;
SG552		=31;
Aug		=33;
Scout		=34;
AWP		=35;
G3SG1		=36;
SG550		=37;

M249		=40;

PrimaryAmmo	=61;
SecondaryAmmo	=62;

HE		=51;
Flashbang	=52;
SmokeGrenade	=53;
Flare		=54;
DefuseKit	=56;
Kevlar		=57;
KevlarHelm	=58;
NightVision	=59;
TacticalShield	=41;

Knife 		=50;
Machete		=69;
Wrench		=74;
Claw		=78;
Chainsaw	=85;

GasGrenade	=72;
MolotovCocktail	=73;
Snowball	=75;
AirStrike	=76;

Mine		=76;

Laser		=45;

Flamethrower	=46;

RPGLauncher	=47;
RocketLauncher	=48;
GrenadeLauncher	=49;

LightArmor	=79;
Armor		=80;
HeavyArmor	=81;
SuperArmor	=83;
MedicArmor	=82;

StealthSuit	=84;

Medikit		=64;
Bandage		=65;

Coins		=66;
Money		=67;
Gold		=68;
So if you need an item ID in your code, you just have write the name of the variable instead the number in your code. You can forget all that numbers, you just have to know the ingame name of the item. But care of the case! Lua is case-sensitive.

Remember not to create a variable "TMP" (TEMP), it will override my variable; The variables "tmp" or "Tmp" would NOT ovveride my variable because Lua is case-sensitive.

It would be better, to use constants instead of variables, but idk how. Doesn't look like that Lua supports constants, am I right?

Here are the codes for the special armor items that a player wears (use them as armor value):
1
2
3
4
5
6
7
8
-- armor IDs
-- use them as armor value to give a player a special armor item
a_LightArmor	= 201;
a_Armor		= 202;
a_HeavyArmor	= 203;
a_SuperArmor	= 205;
a_MedicArmor	= 204;
a_StealthSuit	= 206;
edited 1×, last 28.02.09 04:56:57 pm

old Re: Lua Scripts for CS2D

DC
Admin Off Offline

Quote
Quote
> Will it be possible to change the speed of a certain player?
> Will it be possible to turn FOW on/off for a certain player?
> Will it be possible to provide server-side skins (players/weapons/whatever)?
> Will it be possible to prevent CS2D from showing player information when I point with the cursor on a player?

× sorry, no to all. because all these things are clientside in first instance. Lua scripts can only influence stuff which is handled and sent by the server (giving/removing items, settings health and armor, team, position etc.)

Quote
> Will it be possible to make server-side key bindings?

× no. It could lead to conflicts and it could be abused. like binding a "kill" to mouse1. This is not going to happen.

However the server will be able to open menus for clients with a title and up to 9 buttons. when a client clicks one of the buttons the server will receive this action and you can hook a Lua script (just added this superawesome feature today)

old Re: Lua Scripts for CS2D

DC
Admin Off Offline

Quote
I'm not sure but I think yes. I didn't find an increment operator in the documentation.

(and yes I know that utlevel[killer]=utlevel[killer]+1 would have been shorter/easier)

old Re: Lua Scripts for CS2D

Zune5
COMMUNITY BANNED Off Offline

Quote
DC has written
Quote
> Will it be possible to change the speed of a certain player?
> Will it be possible to turn FOW on/off for a certain player?
> Will it be possible to provide server-side skins (players/weapons/whatever)?
> Will it be possible to prevent CS2D from showing player information when I point with the cursor on a player?

× sorry, no to all. because all these things are clientside in first instance. Lua scripts can only influence stuff which is handled and sent by the server (giving/removing items, settings health and armor, team, position etc.)

Quote
> Will it be possible to make server-side key bindings?

× no. It could lead to conflicts and it could be abused. like binding a "kill" to mouse1. This is not going to happen.

However the server will be able to open menus for clients with a title and up to 9 buttons. when a client clicks one of the buttons the server will receive this action and you can hook a Lua script (just added this superawesome feature today)


wow. Can you do ANYTHING fun in this game?
> Definitely should be possible to mod Speed in this game. It's in CS:S.
> This should be possible with the game Variant Zombies
> Yeah um...would be fun.
> No comment...at least you can teleport people and things though.

old Re: Lua Scripts for CS2D

Admir
User Off Offline

Quote
Zune5 has written
DC has written
Quote
> Will it be possible to change the speed of a certain player?
> Will it be possible to turn FOW on/off for a certain player?
> Will it be possible to provide server-side skins (players/weapons/whatever)?
> Will it be possible to prevent CS2D from showing player information when I point with the cursor on a player?

× sorry, no to all. because all these things are clientside in first instance. Lua scripts can only influence stuff which is handled and sent by the server (giving/removing items, settings health and armor, team, position etc.)

Quote
> Will it be possible to make server-side key bindings?

× no. It could lead to conflicts and it could be abused. like binding a "kill" to mouse1. This is not going to happen.

However the server will be able to open menus for clients with a title and up to 9 buttons. when a client clicks one of the buttons the server will receive this action and you can hook a Lua script (just added this superawesome feature today)


wow. Can you do ANYTHING fun in this game?
> Definitely should be possible to mod Speed in this game. It's in CS:S.
> This should be possible with the game Variant Zombies
> Yeah um...would be fun.
> No comment...at least you can teleport people and things though.


DC only make his own game. so, he like what he want to do.

old Re: Lua Scripts for CS2D

Zune5
COMMUNITY BANNED Off Offline

Quote
Admirdee has written
DC only make his own game. so, he like what he want to do.


If you people are still having this opinion in mind, no one would be playing this game anymore.

old Re: Lua Scripts for CS2D

DC
Admin Off Offline

Quote
you can do a huge amount of things. but nothing clientsided. besides the menus.
that's why I said serverside only. an additional support for speed modifiers could be possible but it is not planned for the next release.

old Re: Lua Scripts for CS2D

Kiffer-Opa
User Off Offline

Quote
About my suggestions about the server-side key-bindings:
I think they are important for providing easy and fast access to the most important special server actions, especially the superawesome menus.

It would be a bit ironically (and dumb) to have on the one side an intuitive menu which can on the other side only be accessed with a stupid chat command.
(Surprise, I really dislike chat commands, they take time to type in, you can't remember all chatcommands and have to search for a command reference [when you're unlucky, such a reference doesn't exist and you have find them out on your own]. These fill the chat area. The output of these commands which is also in the chat is just for a short time visible.)

Lua script support will become then useful when the server can add or change functionalality when the user does not have to learn an unusual or elaborate kind of navigation, like chat commands.


DC has written
It could lead to conflicts

To prevent this:
You could introduce some new special client-to-server commands that the servers can handle. On a server without scripts, these have no function.
These special commands can get bindings by default on, ummm lets say, some of the function keys.
Maybe you call the commands (just as example)
servercmd1
servercmd2
... and so on

So if I press F1, CS2D client gets a "servercmd1" that CS2D sents to the server.
The CS2D client does not make anything more, as these keys are just thought as blanko keys for serverside stuff.
The server can handle this received command, for example opening a superawesome menu or making other stuff.

Well, I also suggest a little convention:
F1 always for a help / info / MOTD screen (server rules, is this a special game with other objective? and a reference to server keys)
F2 always for something like a main menu for serverstuff

and for the other function keys I actually don't know any convention, well, servers can do what they want here.

another option to access these superawesome menus: you just can give the server the possibility to add some buttons in the [Esc] menu. I see there are two places free. These buttons would act like servercmd1, etc.

btw I really LIKE the idea with the menus. It's not only for serverside stuff, I also could make a buyscript menu if I have many buyscripts. Or even a complete chat menu structure where I can access many used team chat lines.



DC has written
could be abused

If a server really makes such a fucking crappy shit script like selfkill on a commonly used key on his server, I don't think that the players will last long on this server.
There are lots of other things, how server operators can abuse Lua scripts to annoy players like a selfkill when you shoot (technically, that is a bit different to your suggested selfkill on mouse1 but the result is the same) or let Terrorists win when a Terrorist walks upward and other stupidity.

There will be abuse, no matter wheather its made with key bindings or with game actions.

old Re: Lua Scripts for CS2D

DC
Admin Off Offline

Quote
hm. you're right. I think I'll add a "custom server action" key. this is probably the best solution.

old Re: Lua Scripts for CS2D

chuico123
User Off Offline

Quote
Kiffer-Opa has written
If a server really makes such a fucking crappy shit script like selfkill on a commonly used key on his server, I don't think that the players will last long on this server.
There are lots of other things, how server operators can abuse Lua scripts to annoy players like a selfkill when you shoot (technically, that is a bit different to your suggested selfkill on mouse1 but the result is the same) or let Terrorists win when a Terrorist walks upward and other stupidity.


true, no one wants to play in a server that you die every time you press the fire button (altrough this can be used in NO KILL maps)

the server admin is a noob if he uses a script just to annoy players that joins his server, the player join the server, selfkill 3 times and leave... and then the server become unpopular

i also recomend a "load script" button or menu (not a separate menu, just put it togheter in the "new game" menu), it will make easyer to load or remove scripts

old Re: Lua Scripts for CS2D

lusi
COMMUNITY BANNED Off Offline

Quote
Hey I see server with RPG mode.In RPG you must kill for exp and level's up.when you level up you got 1 point.you can upgrade magic's.VERY COOL.I hear it make with pytoon language

old Re: Lua Scripts for CS2D

chuico123
User Off Offline

Quote
lusi has written
Hey I see server with RPG mode.In RPG you must kill for exp and level's up.when you level up you got 1 point.you can upgrade magic's.VERY COOL.I hear it make with pytoon language


whats the name of that server?

old Re: Lua Scripts for CS2D

TheRealSephiroth
User Off Offline

Quote
DC has written
I'm not sure but I think yes. I didn't find an increment operator in the documentation.

(and yes I know that utlevel[killer]=utlevel[killer]+1 would have been shorter/easier)


Ideal solution would be "level=++utlevel[killer];" if LUA would support (pre-)increment-operators.

haha i didn't want to blame you for your poor programming skills ;F

old Re: Lua Scripts for CS2D

Tehmasta
User Off Offline

Quote
hey dc, would it be possible to override the standard functions of cs2d, for example, when someone just spawns, you give him 5 secs of high def, so that when they get it, you override the weapon damage, calculate 10% of that and deal that much to the player
also, would you be able to strip of a player of all weapons, including their armor and give it back to them and could you actually change the amount of bullets left in a person's clip and the amount left in their gun?
To the start Previous 1 2 3 4 5 6 7 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview