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 2188 189 190338 339 Next To the start

old Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Quote
Script:
Spoiler >

Could Some 1 Help Me Look I wanna Like It Say When A Admin Enter Admin "player name" joined
how i make that ?

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Quote
More >

old Re: Lua Scripts/Questions/Help

Sleepin
User Off Offline

Quote
Can someone check this script please as it is not working

More >

old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
addhook("second", "hud")
function hud()
	for id = 1, 32 do
		usgn = player(id,"usgn")
		name = player(id,"name")
		wpntype = player(id,"weapontype")
 		 parse("hudtxt2 "..id.." 1 "Your name is "..name" 620 460 1")
 		 parse("hudtxt2 "..id.." 2 "Your USGN is ..usgn" 630 470 1")
  		parse("hudtxt2 "..id.." 3 "The weapon you are holding is "..wpntype" 640 480 1")
  	end
end
That should work, and please when posting scripts use this format: [code ] <your script> [/code ] (without spaces)

Your script did not work because the hook 'second' does not have a parameter for id + you had one too many ends

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@banana

errors:
there isn't a "ID" parameter for the second hook.
Also, you kind-of added an extra end.
I don't think your hudtxt2's will work correctly..

it's better if you use this:
1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("second","hud")
function hud()
		for id=1,32 do
		if player(id,"exists") then
usgn=player(id,"usgn")
name=player(id,"name")
wpntype=player(id,"weapontype")
	parse("hudtxt2 "..id.." 1 'Your name is "..name.." '620 460 1")
	parse("hudtxt2 "..id.." 2 'Your USGN is "..usgn.." '630 470 1")
	parse("hudtxt2 "..id.." 3 'The weapon you are holding is "..wpntype.."' 640 480 1")
end
end
end
which would be correct to have that end.

You forgot to add the extra ".." at the end of your variables in hudtxt2
your
1
2
3
4
"..name"
would have returned as nil
same for "..usgn"
and ..wpntype"

@DarkByte
Your
1
for id=1,32 do
Would have lagged the f**k out of his system,
as it doesn't check
1
if player(id,"exists") then


old Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Quote
Is there a way to call every value in a table through pcall?
Example:
1
2
3
4
args={msg2,1,"hey"}
for i = 2, 3 do
	pcall(args[1], args[i])
end

old Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Quote
1
2
args = {1,"hey"}
pcall(msg2, unpack(args))

Similarly, an unbounded function in terms of its parameter size can be written as follows

1
2
3
4
function arbitrary(...)
	args = {...}
	--TODO: Add Code
end

old Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Quote
Soja1997 has written
Who can make script 5$ for kill not 300$

Try this code then

1
2
3
4
5
addhook("kill","cash")
function cash(id)
	parse("setmoney "..id.." "..player(id,"money")-300);
	parse("setmoney "..id.." "..player(id,"money")+5);
end

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@banana200000

1
2
3
4
5
6
7
8
9
10
11
12
13
addhook("second","hud")
function hud()
          for id=1,32 do
          if player(id,"exists") then
usgn=player(id,"usgn")
name=player(id,"name")
wpntype=player(id,"weapontype")
     parse('hudtxt2 '..id..' 1 "Your name is '..name..' "620 460 1')
     parse('hudtxt2 '..id..' 2 "Your USGN is '..usgn..' "630 470 1')
     parse('hudtxt2 '..id..' 3 "The weapon you are holding is '..wpntype..'" 640 480 1')
end
end
end

Try This

and for colorcode
1
©RRRBBBGGG
Insert the red amount in "RRR"
you must add the 0 in the empty space
e.g.
1
2
3
4
if you want the red amount to be 50
then you must put it as ©050BBBGGG
because it must have the 9 numbers.
If you add an extra number, well that'll just show up on the hudtxt but if you have 1less number then.. one of you letters will get turned into a number to replace it.
e.g.
1
2
3
4
5
--You only put 7 numbers
you put "©0250250 Hi!"
well...
That'll turn into "©0250250Hi !"
and only the "!" will show.

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Replace
1
parse('hudtxt2 '..id..' 3 "The weapon you are holding is '..wpntype..'" 640 480 1')
With
1
parse('hudtxt2 '..id..' 3 "The weapon you are holding is '..itemtype(wpntype,"name")..'" 640 480 1')

old Re: Lua Scripts/Questions/Help

Sleepin
User Off Offline

Quote
Thanks for all your help flacko,and Cmdark . Another question,how do you make pictures in hud?

To G-man:
Read the info.txt in lua folder,it contains basics

old Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Quote
@banana200000

image(path, x, y, mode)
set mode to 2 for a hud image
x and y should be below 640 and 480 respectively, unless you want part of the image to be out of the screen.

old Re: Lua Scripts/Questions/Help

newbienoob
User Off Offline

Quote
can anyone help me make a custom weapon??
i want a weapon like a knife with different sound and different model can anyone give me the lua or script for a knife? sorry for my bad english
To the start Previous 1 2188 189 190338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview