Forum
CS2D Scripts Lua Scripts/Questions/HelpAnd Check your USGN number, maybe it's wrong, and it seems that USGN is offline, try to add -- to if(player(id,"usgn")... and one end.
edited 2×, last 26.01.10 01:39:35 pm
function comprarcasa(id,x,y)
if(player(id,"exists")) then
px = player(id,"tilex")
py = player(id,"tiley")
if px == 21 and py == 21 then
msg2(id,"©255000000 ID: "..casas[1].."")
if casas[1] == 255 then
casas[1] = id
msg2(id,"©255000000 ID: "..casas[1].."")
parse("setmoney "..id.." "..player(id,"money")-1000)
elseif casas[1] ~= id then
msg2(id,"©255000000 Somente o dono pode abrir a casa")
msg2(id,"©255000000 ID: "..casas[1].."")
return 1
end
end
end
end
And is not working, only for admins... =\
Please! All I need to know is if the 'usebutton' hook is working! I don't need no help with Scripting!
edited 1×, last 26.01.10 05:51:23 pm
http://i560.photobucket.com/albums/ss44/leegao/de_dust_00000.jpg
I tried that socket module that you prefer, but only one thing I could do...
Read a text file from certain link.
Blazzingxx has written
Nice work.
I tried those sockets module that you prefer, but only one thing I could do...
Read a text file from certain link.
I tried those sockets module that you prefer, but only one thing I could do...
Read a text file from certain link.
The http compatible sinks can not be used for an embedded system so you have to manipulate everything through raw sockets. But given that, you just need to write a few more layers to manipulate the structural data. For example, the following will work for all valid xml derived data.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function string.tags(text, tag, __list) 	local sub = List{text:find("<[%%s]-%s.->.-<[%%s]-/[%%s]-%s[%%s]->"%{tag, tag})} 	if not __list then __list = List{} end 	if #sub > 0 then 		__list = __list + {text:sub(unpack(sub))} 		return text:sub(sub[2]+1):tags(tag, __list) 	else 		return __list 	end end function tagstrip(text) 	local sub = List{text:find("<.->")} 	if #sub > 0 then 		return tagstrip(text:replace(unpack(sub))) 	else 		return text 	end end function string.replace(text, start, ed) 	if not ed then ed = #text end 	return text:sub(0, start-1)..text:sub(ed+1) end
I am working on some codes for my Server,
but have some problems with it.
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
----------------------- -- HUD: RADAR -- ----------------------- addhook("second","Radar") function Radar(id,x,y,walk) 	rot = player(id,"rot") 	parse('hudtxt2 '..id..' 3 "©000255000Coordinates X: '..x..' Y: '..y..' " 10 105') end ----------------------- -- HUD: LVL -- ----------------------- addhook("second", "CurrentLevel") function CurrentLevel(id,level, killer) 	level=sample.ut.level[killer] 	parse('hudtxt2 '..id..' 3 "©000255000Level: '..level..' " 10 115') end ----------------------- -- HUD: WEP -- ----------------------- addhook("second", "CurrentWep") function CurrentWep(id,level, weapon) 	parse('hudtxt2 '..id..' 3 "©000255000Level: '..weapon..' " 10 125') end
Problems:
1. I got "some" Lua Errors
2. Can i do it in 1 Func instand of 3? (Because of the Func Paramters)
3. Why does the Radar is running but Lvl & Wep not?
2. parameters must be in DIRECTLY right order.
And if you write name of other parameter in place, that must be for first parameter, it will be the name of FIRST parameter, and will make you confused. And hook "SECOND" DOES NOT HAVE ANY PARAMETER. try return function player(id,"smth")
Try this:
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("second","second") function second() 	for id=1,game("sv_maxplayers") do 		if(player(id,"exists") then 			rot[id] = player(id,"rot") 			parse('hudtxt2 '..id..' 3 "©000255000Coordinates X: '..player(id,"x")' Y: '..player(id,"y")..' " 10 105') 			level=sample.ut.level[id] 			parse('hudtxt2 '..id..' 4 "©000255000Level: '..level..' 10 115') 			parse('hudtxt2 '..id..' 5 "©000255000Level: '..item(player(id,"weaponid"),"name")..' " 10 125') 		end 	end end
edited 1×, last 26.01.10 08:58:53 pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
----------------------- -- HUD: LVL -- ----------------------- addhook("second", "CurrentLevel") function CurrentLevel(id,[b]level[/b], killer) level=sample.ut.level[killer] parse('hudtxt2 '..id..' 3 "©000255000Level: '..level..' " 10 115') end ----------------------- -- HUD: WEP -- ----------------------- addhook("second", "CurrentWep") function CurrentWep(id,[b]level[/b], weapon) parse('hudtxt2 '..id..' 3 "©000255000Level: '..weapon..' " 10 125') end
way I really did too much in C++ and Basic <_<
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
----------------------- -- COMPLETE HUD -- ----------------------- addhook("second","HUD") function HUD() 	x = player(id,"x") 	y = player(id,"y") 	weapon = player(id,"weapontype") 	level = player(id,"score") 	parse('hudtxt2 '..id..' 3 "©000255000Coordinates X: '..x..' Y: '..y..' " 10 105') 	parse('hudtxt2 '..id..' 3 "©000255000Weapon: '..weapon..' " 10 115') 	parse('hudtxt2 '..id..' 3 "©000255000Level: '..level..' " 10 125') end
Wrong right? (Cant test it atm x_X)
Shame on my lua skills <_<
Edit:
The Version a bit more up doesnt work.
(fixed the "(" :P)
Still get Nil Errors
edited 1×, last 26.01.10 09:41:44 pm
Use Loop:
1
2
2
For i = 1, 32 do end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
----------------------- -- COMPLETE HUD -- ----------------------- addhook("second","HUD") function HUD() 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,"x")' Y: '..player(id,"y")..' " 10 105') level=sample.ut.level[id] parse('hudtxt2 '..id..' 4 "©000255000Level: '..level..' 10 115') parse('hudtxt2 '..id..' 5 "©000255000Level: '..item(player(id,"weaponid"),"name")..' " 10 125') end end end
Now i got an Error with the "Rot" Value oO
1
2
2
--Add this in function start rot = {}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
----------------------- -- COMPLETE HUD -- ----------------------- addhook("second","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,"x")' Y: '..player(id,"y")..' " 10 105') level=sample.ut.level[id] parse('hudtxt2 '..id..' 4 "©000255000Level: '..level..' 10 115') parse('hudtxt2 '..id..' 5 "©000255000Level: '..item(player(id,"weaponid"),"name")..' " 10 125') end end end
Right? Now i got an Error in this line:
1
parse('hudtxt2 '..id..' 3 "©000255000Coordinates X: '..player(id,"x")' Y: '..player(id,"y")..' " 10 105')
Error:
Attempt to call a number value
1
2
3
4
5
6
7
8
9
10
11
12
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
Don't forget about level variables...
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
addhook("second","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,"x")..' Y: '..player(id,"y")..' " 10 105') 			level=sample.ut.level[id] 			parse('hudtxt2 '..id..' 4 "©000255000Level: '..level..' 10 115') 			parse('hudtxt2 '..id..' 5 "©000255000Level: '..item(player(id,"weaponid"),"name")..' " 10 125') 		end 	end end
So u dont have an Id
Blazzingxx has written
I fixed it.
Don't forget about level variables...
Don't forget about level variables...
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
addhook("second","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,"x")..' Y: '..player(id,"y")..' " 10 105') 			level=sample.ut.level[id] 			parse('hudtxt2 '..id..' 4 "©000255000Level: '..level..' 10 115') 			parse('hudtxt2 '..id..' 5 "©000255000Level: '..item(player(id,"weaponid"),"name")..' " 10 125') 		end 	end end
I quoted it just in case if you haven't noticed...
But i still get soem Problems.
1. The Weapon HUD dont Change.
(If u start with USP and change to Deagle for
example it shows still USP)
Error in this Line:
1
parse('hudtxt2 '..id..' 5 "©000255000Weapon: '..item(player(id,"weaponid"),"name")..' " 10 125')
2. The "Level" thing doesnt even because of the
Error above.
3. The Coordinates are scary
Not like 250,2500 its 250,8438843 and so.
Edit: Fixed Error 2.
1 & 3 are still there
Use "weapontype" value to return weapon id of player. (instead "weaponid")