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 2188 189 190338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

siuL
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Zitieren
Mehr >

alt Re: Lua Scripts/Questions/Help

Sleepin
User Off Offline

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

Mehr >

alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

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


alt Re: Lua Scripts/Questions/Help

archmage
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Lee
Moderator Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Zitieren
Soja1997 hat geschrieben
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

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

Sleepin
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

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

alt Re: Lua Scripts/Questions/Help

newbienoob
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 2188 189 190338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht