Forum

> > CS2D > Scripts > How to start programming in Lua?
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to start programming in Lua?

19 replies
To the start Previous 1 Next To the start

old How to start programming in Lua?

Bobb1118
User Off Offline

Quote
I'd like to know, which file would change the main files in CS2D? Specifically, I'd like to change gun names, damages, fire rates, add experience and leveling, and gametype options.

old Re: How to start programming in Lua?

palomino
User Off Offline

Quote
user Bobb1118 has written
I'd like to know, which file would change the main files in CS2D? Specifically, I'd like to change gun names, damages, fire rates, add experience and leveling, and gametype options.

You can't change gun names. Only with hex. It's illegal.
You can change damage in the console.
You can't change fire rate.
Exp and leveling - look for tibia.
Gametype options - most of it can be changed through server cp.

old Re: How to start programming in Lua?

Cure Pikachu
User Off Offline

Quote
user Bobb1118 has written
ughhh -.- can I add new guns? Is there a way to save the gun damages when they are changed?

New guns - Impossible ×
Saving those settings for weapon damage - Use your autoexec.cfg that is in your sys folder (Only affects your own server)

old Re: How to start programming in Lua?

Bowlinghead
User Off Offline

Quote
Sry, you cant copy it, because there are much links.
Wait...
More >


btw in the info.txt at your Counter-Strike 2D/sys/lua folder is helping you!

old Re: How to start programming in Lua?

Bobb1118
User Off Offline

Quote
thank you very much! and it probably will. i have no knowlege of code yet so im trying to start out by just editing scripts rather than creating them

alright so i made a little script. how in the autoexec.cfg file do i activate it?
edited 1×, last 12.10.11 05:15:01 pm

old Re: How to start programming in Lua?

DC
Admin Off Offline

Quote
don't confuse CS2D commands and Lua scripting. two different things.

Lua scripts go in sys/lua/server.lua
CS2D commands with aliases and binds go in sys/autoexec.cfg

read sys/lua/info.txt, sys/lua/server.lua and the samples in sys/lua/samples if you want to write Lua scripts.

old Re: How to start programming in Lua?

Bobb1118
User Off Offline

Quote
So I have this script here.
Spoiler >


I'm trying to make a basic leveling system. 100 xp for a kill, 500 xp per level, max 80 levels.

right now i get the error :48: '<eof>' expected near 'end'

halp?

also want to have a bar that stays on screen all the time that shows experience, and shows your level. also a "+100 exp" popup over you when you kill someone and a "Level up! Level increased to (current level)"

old Re: How to start programming in Lua?

Bowlinghead
User Off Offline

Quote
You can make a text with hudtxt and a maximum level can show like this:

1
2
3
if your_level[id]>80 then -- If this level is higher then 80
	your_level[id]=80  -- Then reset the level to 80!
end

<eof> means "end of function" (or something like that) . You forgot an end or made to much ends.
If you use notepad++ you see if you forgot an end or you made 1 end to much.
BUT IN YOUR SCRIPT IS 1 END TO MUCH!

1
2
3
4
5
if (sample.gg.experience[id]>=500) then
          -- Increase Level
          sample.gg.level[id]=sample.gg.level[id]+1
          end -- This end is wrong
     end

EVERY "if then" "function" "for do" and other need an END!

old Re: How to start programming in Lua?

Bobb1118
User Off Offline

Quote
This script works!

Spoiler >


how do i use hudtext?

old Re: How to start programming in Lua?

Kel9290
User Off Offline

Quote
Spoiler >

Read tutorial at wiki.
edited 1×, last 12.10.11 07:40:52 pm

old Re: How to start programming in Lua?

HeroBurak
BANNED Off Offline

Quote
user Bobb1118 has written
I'd like to know, which file would change the main files in CS2D? Specifically, I'd like to change gun names, damages, fire rates, add experience and leveling, and gametype options.


1. open notepad
2. start typing
3. ???
4. PROFIT!
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview