Forum

> > CS2D > Scripts > Usgn image
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Usgn image

19 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Usgn image

D-D3ADxPro
User Off Offline

Zitieren
I was wondering how you could get a image to act like a usgn. If you do have a usgn, the hudtxt will show at the image saying "USGN '..player(id,"usgn")..'". If you don't have a usgn, it will just show "Not Registered!"

Heres my script that I tried to do:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("startround","_usgnprohud")
function _usgnprohud()
	local id=image("gfx/GoPro/usgn.png",0,0,2)
	imagealpha(id,1.0)
	imagepos(id,334,374,0)
end

addhook("startround","_usgnhudtxt")
function _usgnhudtxt()
	if (player(id,"usgn")>0) then
	parse('hudtxt2 '..id..' 26 "©255128000USGN: '..player(id,"usgn")..'" 292 363')
	msg2(id,"©000255000Logged in as "..player(id,"usgn").."!")
else
	parse('hudtxt2 '..id..' 26 "©255000000Not Registered!" 292 363')
	msg2(id,"©255000000You don't have a USGN! Log-in or register!")
end

The console just shows up a LUA ERROR: attempt to call a nil value. And it just spams up the whole console.

alt Re: Usgn image

_Yank
User Off Offline

Zitieren
In that function called _usgnhudtxt. There's no id parameter (line 10).
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("startround","_usgnprohud")
function _usgnprohud()
     local id=image("gfx/GoPro/usgn.png",0,0,2)
     imagealpha(id,1.0)
     imagepos(id,334,374,0)
end

addhook("startround","_usgnhudtxt")
function _usgnhudtxt()
	 local pl_count=game("sv_maxplayers")
     for i = 1,pl_count
     if (player(i,"usgn")>0) then
     parse('hudtxt2 '..i..' 26 "©255128000USGN: '..player(i,"usgn")..'" 292 363')
     msg2(id,"©000255000Logged in as "..player(i,"usgn").."!")
else
     parse('hudtxt2 '..i..' 26 "©255000000Not Registered!" 292 363')
     msg2(id,"©255000000You don't have a USGN! Log-in or register!")
end

alt Re: Usgn image

D-D3ADxPro
User Off Offline

Zitieren
1
LUA ERROR: sys/lua/AdminScript/server.lua:172: 'do' expected near 'if'

Line 12 in your script has an error.

alt Re: Usgn image

_Yank
User Off Offline

Zitieren
Oh didnt notify o.O
It was your fault.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("startround","_usgnprohud")
function _usgnprohud()
	local id=image("gfx/GoPro/usgn.png",0,0,2)
	imagealpha(id,1.0)
	imagepos(id,334,374,0)
end

addhook("startround","_usgnhudtxt")
function _usgnhudtxt()
	local pl_count=game("sv_maxplayers")
	for i = 1,pl_count
		if (player(i,"usgn")>0) then
		parse('hudtxt2 '..i..' 26 "©255128000USGN: '..player(i,"usgn")..'" 292 363')
		msg2(id,"©000255000Logged in as "..player(i,"usgn").."!")
	else
		parse('hudtxt2 '..i..' 26 "©255000000Not Registered!" 292 363')
		msg2(id,"©255000000You don't have a USGN! Log-in or register!")
	end
end
Please learn how to use tabs, im sure that will help you a lot.

alt Re: Usgn image

Infinite Rain
Reviewer Off Offline

Zitieren
@user _Yank:
No, it's your fault.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("startround","_usgnprohud")
function _usgnprohud()
     local id=image("gfx/GoPro/usgn.png",0,0,2)
     imagealpha(id,1.0)
     imagepos(id,334,374,0)
end

addhook("startround","_usgnhudtxt")
function _usgnhudtxt()
     local pl_count=game("sv_maxplayers")
     for i = 1,pl_count do
          if (player(i,"usgn")>0) then
          parse('hudtxt2 '..i..' 26 "©255128000USGN: '..player(i,"usgn")..'" 292 363')
          msg2(id,"©000255000Logged in as "..player(i,"usgn").."!")
     else
          parse('hudtxt2 '..i..' 26 "©255000000Not Registered!" 292 363')
          msg2(id,"©255000000You don't have a USGN! Log-in or register!")
     end
end

alt Re: Usgn image

_Yank
User Off Offline

Zitieren
@user Infinite Rain:
No, that was our fault.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("startround","_usgnprohud")
function _usgnprohud()
     local id=image("gfx/GoPro/usgn.png",0,0,2)
     imagealpha(id,1.0)
     imagepos(id,334,374,0)
end

addhook("startround","_usgnhudtxt")
function _usgnhudtxt()
     local pl_count=game("sv_maxplayers")
     for i = 1,pl_count do
          if (player(i,"usgn")>0) then
          parse('hudtxt2 '..i..' 26 "©255128000USGN: '..player(i,"usgn")..'" 292 363')
          msg2(i,"©000255000Logged in as "..player(i,"usgn").."!")
     else
          parse('hudtxt2 '..i..' 26 "©255000000Not Registered!" 292 363')
          msg2(i,"©255000000You don't have a USGN! Log-in or register!")
     end
end

alt Re: Usgn image

_Yank
User Off Offline

Zitieren
@user D-D3ADxPro:
Was your fault again ._.
And please try to do a better use of your brain, i believe it has potential. Why was you using startround hook ?
IMG:https://oi39.tinypic.com/1imud5.jpg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("startround","_usgnprohud")
function _usgnprohud()
     local id=image("gfx/GoPro/usgn.png",0,0,2)
     imagealpha(id,1.0)
     imagepos(id,334,374,0)
end

addhook("spawn","_usgnhudtxt")
function _usgnhudtxt(id)
	if (player(id,"usgn")>0) then
		parse('hudtxt2 '..id..' 26 "©255128000USGN: '..player(id,"usgn")..'" 292 363')
		msg2(id,"©000255000Logged in as "..player(id,"usgn").."!")
	else
		parse('hudtxt2 '..id..' 26 "©255000000Not Registered!" 292 363')
		msg2(i,"©255000000You dont have a USGN! Log-in or register!")
	end
end
4× editiert, zuletzt 28.07.13 19:16:31

alt Re: Usgn image

Gajos
BANNED Off Offline

Zitieren
Replace this:
1
parse('hudtxt2 '..id..' 26 "©255128000USGN: '..player(id,"usgn")..'" 292 363')
on this:
1
parse('hudtxt2 '..id..' 26 "©255128000USGN: '..player(id,'usgn')..'" 292 363')

alt Re: Usgn image

_Yank
User Off Offline

Zitieren
user brofistmsia hat geschrieben
Best if use autorun scripts. It always work for me.

You mean samples, and dont talk when you dont know what we're talking about. You dont know lua ? Stay away of this posts.

alt Re: Usgn image

D-D3ADxPro
User Off Offline

Zitieren
Lua Error

Heres the full script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
addhook("startround","_usgnprohud")
function _usgnprohud()
     local id=image("gfx/GoPro/usgn.png",0,0,2)
     imagealpha(id,1.0)
     imagepos(id,334,374,0)
end

addhook("startround","_usgnhudtxt")
function _usgnhudtxt(i,p)
     local pl_count=game("sv_maxplayers")
     for i = 1,pl_count do
          if (player(i,"usgn")>0) then
          parse('hudtxt2 '..i..' 26 "©255128000USGN: '..player(i,"usgn")..'" 292 363')
          msg2(p,"©000255000Logged in as "..player(i,"usgn").."!")
     else
          parse('hudtxt2 '..i..' 26 "©255000000Not Registered!" 292 363')
			msg2(p,"©255000000You don't have a USGN! Log-in or register!")
		 end
     end
end
Tried to change the "id" to "p" in the msg2's but they dont seem to work. Also, everytime I move a tile, IT will flood it with: LUA ERROR: attempt to call a nil value

alt Re: Usgn image

_Yank
User Off Offline

Zitieren
Why you're not using the script i post above ? -.-
Why are you using startround hook ?

alt Re: Usgn image

_Yank
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("join","_usgnprohud")
function _usgnprohud(id)
     local id=image("gfx/GoPro/usgn.png",0,0,2)
     imagealpha(id,1.0)
     imagepos(id,334,374,0)
end

addhook("join","_usgnhudtxt")
function _usgnhudtxt(id)
     if (player(id,"usgn")>0) then
          parse('hudtxt2 '..id..' 26 "©255128000USGN: '..player(id,"usgn")..'" 292 363')
          msg2(id,"©000255000Logged in as "..player(id,"usgn").."!")
     else
          parse('hudtxt2 '..id..' 26 "©255000000Not Registered!" 292 363')
          msg2(i,"©255000000You dont have a USGN! Log-in or register!")
     end
end

I thought you was using startround hook for a specific reason IMG:https://backcountrypost.com/forum/addedsmilies/facepalm.gif

Man click here @cs2d lua hook startround
Theres no id parameter. Let me try to explain what a parameter is. Imagine that you want to make a script which says "Player (name) said : (txt)" every time you say something. Then you will use say hook. First catch the id and the text of the player who said something. Then the parameters must be text and id "function _say(id,text)". But you cant do that when the hook is minute. That function with minute hook will be executed every minute, then theres nothing which we can catch.
It would be nice an time parameter but it's stupid
2× editiert, zuletzt 31.07.13 12:22:51
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht