Forum
CS2D General Lua Scripts for CS2DPoll
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
Very good idea for it!
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"
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
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;
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
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
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?
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)
1
2
3
2
3
level=utlevel[killer]; level=level+1; utlevel[killer]=level;
Is there a lack of "integer++/++integer" in LUA?
(and yes I know that utlevel[killer]=utlevel[killer]+1 would have been shorter/easier)
DC has written
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.)
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)
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?
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.
Zune5 has written
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 has written
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.)
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)
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?
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.
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.
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.
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.
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.
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
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?
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)
(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
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?