Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Lua Scripts/Questions/Help

6.770 Antworten
Seite
Zum Anfang Vorherige 1 2187 188 189338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Zitieren
you can make your own money variable in Lua for "virtual" money. when the real money becomes low and if there still is virtual money in your variable, you decrease the virtual money by amount X and increase the real money by the same amount.

however this is a dirty solution and the money display will always display a maximum of 16000$. you can't change this limit.

alt Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Zitieren
Or like in [CC] Roleplay!
The "real" money is 0 everytime.
Only "virtual" money is used.
It's showed by a hudtxt over the normal money.

alt Re: Lua Scripts/Questions/Help

Tenaika
User Off Offline

Zitieren
Go to your CS2D folder then go to 'sys' then to 'lua' folder and open server.lua. Then if you want to start a totally new script, delete everything in there and write your lua code.

P.S. Yes, you need to know lua to script. Duh.

alt Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
addhook("kill","RIP")
function RIP(id)
	if (player(id,"money")>5999) then
		parse("setmoney "..id.." "..player(id,"money")-6000)
          freeimage(id)
          id1=image("gfx/RIP.bmp",1,1,200+id) 
		imagecolor(id1,255,255,255)						
		imageblend(id1,0)								
		imagealpha(id1,0.5)	
	end
	end
for what when I am dying isn't erecting the gravestone

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Ruirize hat geschrieben
You're applying it to a dead player. Fail.

Lol? That's not what's wrong.
I won't fix it for you but:
•You should use 'die' hook, specially because it has x and y parameters.
•You should use an array to store images' ids.
•You should use imagepos.
•You shouldn't copy DC's glowing players example.
•You should learn lua so you understand what you are doing.

alt Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Zitieren
Is there any way to execute a ini file as part of a script? (ie for settings etc)
an example would be
givewrench=0
splitteams=1
in the ini file.

Also how could you select a random player from a specific team?

alt Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

Zitieren
you would need to create a table with all the players of one team, then use math.randomseed(os.clock()) and math.random(table#)

alt Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Zitieren
@banana200000
what code would i need to execute the file
perhaps something like
file = assert(io.open("sys/lua/...
but after that i'm not sure

alt Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Zitieren
May I know if there is a hook for destroying buildings?

edit:
@saladface27
dofile('sys/lua/...')
1× editiert, zuletzt 13.04.10 14:25:37

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
weiwen hat geschrieben
May I know if there is a hook for destroying buildings?

I see only this in info txt:
break(x,y)                              on breaking a breakable entity
-x: breakable x (tiles)
-y: breakable y (tiles)

alt Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Zitieren
Patasuss hat geschrieben
I think break(x,y) is for the breakables from Editor.

Exactly, but maybe it will fit to destroying buildings...

alt Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Zitieren
I want to make that a player1 cannot destroy a building of player2 (both in same team). But that player2 can destroy his own building?
How could i do that?
Zum Anfang Vorherige 1 2187 188 189338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht