Forum
CS2D Scripts Lua Scripts/Questions/Help Flacko has written
@Rit:
That's not my fault.
@Leo:
You have to use setmaxhealth and you have to use parethesis in the right way.
@Anders
That's not my fault.
@Leo:
You have to use setmaxhealth and you have to use parethesis in the right way.
@Anders
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
function math.round(n) a = math.floor(n) + 0.5 if a > n then return math.floor(n) elseif a <= n then return math.ceil(n) end end
How should it fit in with my code? (;
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
-- Player-position parse([[hudtxt2 ]]..id..[[ 6 "©000255000Player-Position:" 5 183]]) function math.round(n) 	a = math.floor(n) + 0.5 	if a > n then 		return math.floor(n) 	elseif a <= n then 		return math.ceil(n) 	end end parse([[hudtxt2 ]]..id..[[ 7 "©000255000Pixels: ]]..playerx..[[ x ]]..playery..[[" 5 196]]) parse([[hudtxt2 ]]..id..[[ 8 "©000255000Tiles: ]]..player(id,"tilex")..[[ x ]]..player(id,"tiley")..[[" 5 209]])
playery = math.round(playery)
playerx = math.round(playerx)
And please, stop using those smileys, they are annoying me
Flacko has written
Ugh, you don't know what's a function, right?
playery = math.round(playery)
playerx = math.round(playerx)
And please, stop using those smileys, they are annoying me
playery = math.round(playery)
playerx = math.round(playerx)
And please, stop using those smileys, they are annoying me
lol, i'll stop making smileys then..
This is my code now:
It just still don't work..
It gives me a "end" error... s:
Read something about lua. (tutorial ect)
As Flacko said, you have no idea how functions works...
Just use math.ceil()
Blazzingxx has written
LOL, OMG...
Read something about lua. (tutorial ect)
As Flacko said, you have no idea how functions works...
Just use math.ceil()
Read something about lua. (tutorial ect)
As Flacko said, you have no idea how functions works...
Just use math.ceil()
Yea right! You can easily say that!
I don't know what the f*ck it does!?
Or.. yes i actually do.. But just with nothing in the "()"? Cause' on they'r website they say "math.ceil (x)"
edited 1×, last 09.02.10 03:29:54 pm
Also hudtxt parse looked like someone else...
Ok, that's what you want?
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("always","akd_hud_always_pp") function akd_hud_always_pp() 	for id = 1, game("sv_maxplayers"), 1 do 		if player(id,"exists") then 			x = math.ceil(player(id,"x")) 			y = math.ceil(player(id,"y")) 			parse('hudtxt2 '..id..' 6 "©000255000Player-Position:" 5 183') 			parse('hudtxt2 '..id..' 8 "©000255000Tiles: '..player(id,"tilex")..' x '..player(id,"tiley")..'" 5 209') 			parse('hudtxt2 '..id..' 7 "©000255000Pixels: '..x..' x '..y..'" 5 196') 		end 	end end
Blazzingxx has written
Your code used too many useless variables...
Also hudtxt parse looked like someone else...
Ok, that's what you want?
Also hudtxt parse looked like someone else...
Ok, that's what you want?
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
addhook("always","akd_hud_always_pp") function akd_hud_always_pp() 	for id = 1, game("sv_maxplayers"), 1 do 		if player(id,"exists") then 			x = math.ceil(player(id,"x")) 			y = math.ceil(player(id,"y")) 			parse('hudtxt2 '..id..' 6 "©000255000Player-Position:" 5 183') 			parse('hudtxt2 '..id..' 8 "©000255000Tiles: '..player(id,"tilex")..' x '..player(id,"tiley")..'" 5 209') 			parse('hudtxt2 '..id..' 7 "©000255000Pixels: '..x..' x '..y..'" 5 196') 		end 	end end
Waw, lol.. It is that easy! Haha
Thanks a lot!
1
parse("setmoney "..id.." "..player(id,"money") - x)
1
parse("setmoney "..id.." -10000")
Thx Blazzing!
2) I wanna change the damage of the claw by 0 but my script doesnt'work
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("hit","impacto") function impacto(id,source,wpn,hpdmg,apdmg) 		if id == 0 then 			if wpn == 78 then 				hpdmg = 0 			end 	end end
I gave you right example. You are getting me mad...
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
x = 1 addhook("always","asd") function asd() 	for i = 1, 32 do 		if (player(i,"exists")) then 			parse("setmoney "..i.." "..player(i,"money") - x) 		end 	end end
2nd one.
You can't manipulate damage by just changing local variable
Use parse() and return instead.
2)I will try it
Zanahoria has written
2) I wanna change the damage of the claw by 0 but my script doesn't work
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
addhook("hit","impacto") function impacto(id,source,wpn,hpdmg,apdmg) 	if id == 0 then 		if wpn == 78 then 			hpdmg = 0 		end 	end end
This should help with your claw-thing (:
1
parse('mp_wpndmg claw 0')
You dont need any addhook (:
just check the x and y tile position of the player via "if"
and than equip him....
example:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook ("second","sec") function sec(id) for id = 1,32,1 do //counts from 1 to 32 ind 1 steps and the var "id" is the current number if (player(id,"exists")) then //only trigger if the player exists. if (player(id,"tilex")==yourtilex and player(id,"tiley") ==yourtiley) then //checks the position parse ("equip "..id.." iid") //equips end end end end
edited 1×, last 09.02.10 07:34:48 pm
Schinken has written
yes.
just check the x and y tile position of the player via "if"
and than equip him....
example:
just check the x and y tile position of the player via "if"
and than equip him....
example:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
addhook ("second","sec") function sec(id) for id = 1,32,1 do //counts from 1 to 32 ind 1 steps and the var "id" is the current number if (player(id,"exists")) then //only trigger if the player exists. if (player(id,"tilex")==yourtilex and player(id,"tiley") ==yourtiley) then //checks the position parse ("equip "..id.." iid") //equips end end end end
Pretty cool actually!
But you can also just make an item in the map.. s:
I don't see the deference other than the one in the lua-script is invisible (: