Forum

> > CS2D > Scripts > Lua Scripts/Questions/Help
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua Scripts/Questions/Help

6,770 replies
Page
To the start Previous 1 2187 188 189338 339 Next To the start

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

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

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

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

old Re: Lua Scripts/Questions/Help

Tenaika
User Off Offline

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

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Ruirize has written
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.

old Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Quote
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?

old Re: Lua Scripts/Questions/Help

ohaz
User Off Offline

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

old Re: Lua Scripts/Questions/Help

saladface27
User Off Offline

Quote
@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

old Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

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

edit:
@saladface27
dofile('sys/lua/...')
edited 1×, last 13.04.10 02:25:37 pm

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
weiwen has written
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)

old Re: Lua Scripts/Questions/Help

Vectarrio
User Off Offline

Quote
Patasuss has written
I think break(x,y) is for the breakables from Editor.

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

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Quote
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?
To the start Previous 1 2187 188 189338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview