Forum

> > CS2D > Scripts > How to start programming in Lua?
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch How to start programming in Lua?

19 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt How to start programming in Lua?

Bobb1118
User Off Offline

Zitieren
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.

alt Re: How to start programming in Lua?

palomino
User Off Offline

Zitieren
user Bobb1118 hat geschrieben
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.

alt Re: How to start programming in Lua?

Cure Pikachu
User Off Offline

Zitieren
user Bobb1118 hat geschrieben
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)

alt Re: How to start programming in Lua?

Bowlinghead
User Off Offline

Zitieren
Sry, you cant copy it, because there are much links.
Wait...
Mehr >


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

alt Re: How to start programming in Lua?

Bobb1118
User Off Offline

Zitieren
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?
1× editiert, zuletzt 12.10.11 17:15:01

alt Re: How to start programming in Lua?

DC
Admin Off Offline

Zitieren
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.

alt Re: How to start programming in Lua?

Bobb1118
User Off Offline

Zitieren
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)"

alt Re: How to start programming in Lua?

Bowlinghead
User Off Offline

Zitieren
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!

alt Re: How to start programming in Lua?

Bobb1118
User Off Offline

Zitieren
This script works!

Spoiler >


how do i use hudtext?

alt Re: How to start programming in Lua?

Kel9290
User Off Offline

Zitieren
Spoiler >

Read tutorial at wiki.
1× editiert, zuletzt 12.10.11 19:40:52

alt Re: How to start programming in Lua?

HeroBurak
BANNED Off Offline

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