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 2148 149 150338 339 Next To the start

old Re: Lua Scripts/Questions/Help

SenSidethink
User Off Offline

Quote
K, got everything to work now.

Just one Problem:
1
parse('hudtxt2 '..id..' 4 "©000255000Weapon: '..item(player(id,"weapontype"),"name")..' " 10 125')
Returns the wrong Wep (yes i know why o_X)
But how to fix it?

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
My post got lost in the previous page so I`m reposting it
redefinder has written
Why doesn`t this work?
1
2
3
4
5
6
7
8
9
10
11
12
-----------------------
----ADMIN SAY-----
-----------------------
addhook("say","adminsay")
function adminsay(id)
     for i,_usgn in ipairs(RANK.ADMIN) do
          if player(id,"usgn") == _usgn then
          msg(©000255000 "..player(player, "name").." (Admin): "..text)
          return 1
           end
     end
end
It`s purpose is to make message of admin green and add word (Admin) to it.

Someone help me plz.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
SenSidethink has written
Shoud be because u cant login to USGN atm.
So u dont have an Id

SenSidethink has written
I just answered lol

It cant work atm since u dont get a USGN ID
atm because the Server are down.

I know lol......
I tried without those lines that make script to require USGN id
1
2
3
4
5
6
addhook("say","adminsay")
msg(©000255000 "..player(player, "name").." (Admin): "..text)
return 1
end
end
end

old Re: Lua Scripts/Questions/Help

SenSidethink
User Off Offline

Quote
1
2
3
4
5
6
addhook("say","adminsay")
function adminsay(id,txt)
	if (player(id,"usgn")==xxx) then <- Put ur USGN instand of xxx
	msg("©255255255"..player(id,"name").." (Admin):"..txt)
	End
End

Untested.

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
SenSidethink has written
addhook("say","adminsay")
function adminsay(id,txt)
if (player(id,"usgn")==xxx) then <- Put ur USGN instand of xxx
msg("©255255255"..player(id,"name").." (Admin):"..txt)
End
End


Untested

Thanks a lot ,it works.
By the way I improved it a bit:
1
2
3
4
5
addhook("say","adminsay")
function adminsay(id,txt)
     msg("©255000000"..player(id,"name").." (Admin): "..txt)
     return 1
end
And also you don`t need this line for message to work
1
if (player(id,"usgn")==xxx) then

old Re: Lua Scripts/Questions/Help

Redefinder
User Off Offline

Quote
SenSidethink has written
If u dont have the Line
Code:
if (player(id,"usgn")==xxx) then


Everyone will write as a "Admin"...
xDD

yes,I just made this to test it because usgn is offline:
1
2
3
4
5
addhook("say","adminsay")
function adminsay(id,txt)
msg("©255000000"..player(id,"name").." (Admin): "..txt)
return 1
end
When the usgn will be back online the script will look like this:
1
2
3
4
5
6
7
addhook("say","adminsay")
function adminsay(id,txt)
for i,_usgn in ipairs(RANK.ADMIN) do
if player(id,"usgn") == _usgn then 
msg("©255000000"..player(id,"name").." (Admin): "..txt)
return 1
end

old Re: Lua Scripts/Questions/Help

SenSidethink
User Off Offline

Quote
I still got a Problem with this:
1
parse('hudtxt2 '..id..' 4 "©000255000Weapon: '..item(player(id,"weapontype"),"name")..' " 10 125')

Someone know how to fix it?

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Try this
1
parse([[hudtxt2 ]]..id..[[ 4 '©000255000Weapon: ]]..item(player(id,"weapontype"),"name")..[[' 10 125]])

old Re: Lua Scripts/Questions/Help

SenSidethink
User Off Offline

Quote
The Func like i have it atm:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-----------------------
-- COMPLETE HUD --
-----------------------
addhook("always","HUD")
function HUD()
	rot = {}
	for id = 1, game("sv_maxplayers"), 1 do
		if player(id,"exists") then
			rot[id] = player(id,"rot")
			parse('hudtxt2 '..id..' 3 "©000255000Coordinates X: '..player(id,"tilex")..' Y: '..player(id,"tiley")..' " 10 100')
			parse('hudtxt2 '..id..' 4 "©000255000Health: '..player(id,"health")..' Armor: '..player(id,"armor")..' " 10 113')
			parse('hudtxt2 '..id..' 5 "©000255000Weapon: '..item(player(id,"weapontype"),"name")..' " 10 126')
			level=sample.ut.level[id]
			parse('hudtxt2 '..id..' 6 "©000255000Level: '..level..' " 10 139')

		end
	end
end

Everything works, just the Wep is allways "Claw"

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Oh, yeah, there was a small error
1
parse([[hudtxt2 ]]..id..[[ 4 '©000255000Weapon: ]]..itemtype(player(id,"weapontype"),"name")..[[' 10 125]])

old Re: Lua Scripts/Questions/Help

SenSidethink
User Off Offline

Quote
Nice, it shows the right Wep now.

Problem:
It displays

"©000255000Weapon: Knife"
at the top left of the Screen, not at the Pos.



Edit: Fixed it.
1
parse([[hudtxt2 ]]..id..[[ 4 "©000255000Weapon: ]]..itemtype(player(id,"weapontype"),"name")..[[" 10 125]])

Edit2:
Is it possible to make a Box? (Background for HUD)
With a func?
edited 2×, last 27.01.10 01:43:12 am

old Re: Lua Scripts/Questions/Help

leoska
User Off Offline

Quote
I need a little help.
I created a Rank system but my kpd need in filtrations. When dialing "rank" he gives such values Kills: 20 Dies: 3 KPD: 6.77777 = [I need 6.77] ...

Sorry i bad speak english.

old Re: Lua Scripts/Questions/Help

SenSidethink
User Off Offline

Quote
2 Problems i have now.


a) Is there a way to create a Shape
(Background for a HUD) without using a
Image? Like a shape Func?

b) Is there a Var that contains the alive Players?
Because i want to show how much T's and CT's
are alive

old Re: Lua Scripts/Questions/Help

wups
User Off Offline

Quote
SenSidethink has written
2 Problems i have now.


a) Is there a way to create a Shape
(Background for a HUD) without using a
Image? Like a shape Func?

b) Is there a Var that contains the alive Players?
Because i want to show how much T's and CT's
are alive


A) I dont know

B) Use a for loop and check if they are alive. Use own func tion, and add it to the checker. If alive(p) then do this else dead.
To the start Previous 1 2148 149 150338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview