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 2114 115 116338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Blazzingxx has written
@Deatherr,
Help? Should I script bank system?

Yeah, you should script everything they tell you to do because they don't even want to try doing it by theirselves.

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
Flacko has written
Blazzingxx has written
@Deatherr,
Help? Should I script bank system?

Yeah, you should script everything they tell you to do because they don't even want to try doing it by theirselves.


....I have tried.......I just can't get the bank menu to open . I think that the only problem for the script now.

old o.O

- Suppp -
User Off Offline

Quote
is there some kind of program what makes the scripts?..
sry, im newbie with scripts.i think script making would be easier if i have the program what will make them! cookie

old Re: Lua Scripts/Questions/Help

Deatherr
User Off Offline

Quote
Flacko has written
Post what you have tried and we will gladly fix it, then


Thank you!

Spoiler >

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@Deatherr,
To open bank menu, press any serveraction.

Here is my bank script for you.
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
addhook("join","bank_join")
addhook("menu","bank_menu")
addhook("serveraction","bank_serveraction")

function array(m)
	local array = {}
	for i = 1, m do
		array[i] = 0
	end
	return array
end

bank_money_player = array(32)
bank_table = {500,1000,2500,5000}

function bank_join(p)
	bank_money_player[p] = 0
end

function bank_serveraction(p)
	menu(p,"Bank Menu (Your Cash: "..bank_money_player[p].."),Add Cash To Bank,Take Cash From Bank")
end

function bank_cash_add(p)
	menu(p,"Add Cash To Bank? (Bank: "..bank_money_player[p].."),500$,1000$,2500$,5000$")
end

function bank_cash_take(p)
	menu(p,"Take Cash From Bank? (Bank: "..bank_money_player[p].."),500$,1000$,2500$,5000$")
end

function bank_menu(p,t,s)
	if ("Bank Menu" == string.sub(t, 1, 9)) then
		if (s == 1) then
			bank_cash_add(p)
		elseif (s == 2) then
			bank_cash_take(p)
		end
	end
	
	if ("Add" == string.sub(t, 1, 3)) then
		if (bank_table[s] < player(p,"money")) then
			bank_money_player[p] = bank_money_player[p] + bank_table[s]
			parse('setmoney '..p..' '..player(p,"money") - bank_table[s])
			msg2(p,'©000255000You Added '..bank_table[s]..'$ To Bank!@C')
			bank_cash_add(p)
		else
			msg2(p,'©255000000You Added '..player(p,"money")..'$ To Bank!@C')
			msg2(p,'©255000000You Dont Have More Money To Add!@C')
			bank_money_player[p] = bank_money_player[p] + player(p,"money")
			parse('setmoney '..p..' 0')
		end
	end

	if ("Take" == string.sub(t, 1, 4)) then
		if (bank_money_player[p] > 0) then
			if (player(p,"money") + bank_table[s] < 16000) then
				bank_money_player[p] = bank_money_player[p] - bank_table[s]
				parse('setmoney '..p..' '..player(p,"money") + bank_table[s])
				msg2(p,'©000255000You Took '..bank_table[s]..'$ From Bank!@C')
				bank_cash_take(p)
			else
				msg2(p,'©255000000You Cant Have More Than 16000$ In Hand!@C')
			end
		else
			msg2(p,'©255000000Your Bank Is Empty!@C')
		end
	end
end

old Re: Lua Scripts/Questions/Help

DaveRodec
BANNED Off Offline

Quote
1
2
3
4
5
for id,val in ipairs(player(0,"table")) do
	if(player(val,"health") > 0) then
		parse("equip "..val.." 45")
	end
end
edited 2×, last 11.12.09 08:30:31 pm

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Uhhhhhh
1
2
3
4
5
function givelaser()
	for i,p in ipairs( player(0,"table") ) do
		parse("equip "..p.." 45")
	end
end
In console you can write "lua givelaser()" (without quotes) to give everyone a nice little laser.
Good luck.

old Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

Quote
I need help... idk what is wrong in this lua:
Spoiler >


Plz help me

~Console~
LUA ERROR: sys/lua/desk.lua:9: attempt to perform arithmetic on global 'i' (a nil value)

old Re: Lua Scripts/Questions/Help

DC
Admin Off Offline

Quote
there is a 100+i in your code. however you never assigned a value to i. therefore you can't add it to 100 because adding an undefined value to 100 doesn't work.

I think you wanted to write 100+id instead.

moreover you are setting id to the image id. you are overwriting the player id. but later (player(id,"team")) you are using id as if it still contains the player id. which is not the case. its not going to work.

you have to use 2 different variable names. mabye "iid" for image id and keep id for the player id.

please read a tutorial about scripting/Lua and try to actually understand your scripts. stupid copy&paste does not work in most cases as you see.

old Re: Lua Scripts/Questions/Help

leoska
User Off Offline

Quote
I think you can ask about the flashlight.
flashlight I did but now there is a problem with me. cannot not understand how to make a turn and off at 1 serveraction

old Re: Lua Scripts/Questions/Help

leoska
User Off Offline

Quote
yea, but there is one problem
Spoiler >

yet I cannot find the reason why it does not work

old Re: Lua Scripts/Questions/Help

leoska
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
function player_flashlight()
	for i=1,32,1 do
		id=image("gfx/sprites/flashlight.png",1,1,200+i)
		imagecolor(id,255,255,255)
		imageblend(id,1)
		imagealpha(id,0.5)
  		imagescale(id,1,1)
	end
end

player_flashlight()
To the start Previous 1 2114 115 116338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview