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 2159 160 161338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

0ito
User Off Offline

Zitieren
need help for put the terrorists and counter-terrorist in the survivors in the zombie mod if someone help me on what to put in the script I thank

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Flacko hat geschrieben
@Rit:
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
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
-- 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]])

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
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

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

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


lol, i'll stop making smileys then..

This is my code now:
Spoiler >

It just still don't work..
It gives me a "end" error... s:

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
LOL, OMG...
Read something about lua. (tutorial ect)
As Flacko said, you have no idea how functions works...

Just use math.ceil()

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Blazzingxx hat geschrieben
LOL, OMG...
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)"
1× editiert, zuletzt 09.02.10 15:29:54

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
Your code used too many useless variables...
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
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

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Blazzingxx hat geschrieben
Your code used too many useless variables...
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
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!

alt Re: Lua Scripts/Questions/Help

Zanahoria
User Off Offline

Zitieren
1)I tried with
1
parse("setmoney "..id.."  -10000")
and it doesn't work

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
addhook("hit","impacto")
function impacto(id,source,wpn,hpdmg,apdmg)
		if id == 0 then
			if wpn == 78 then
				hpdmg = 0
			end
	end
end

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
First.
I gave you right example. You are getting me mad...
1
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.

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Zanahoria hat geschrieben
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
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 (:

alt Re: Lua Scripts/Questions/Help

TimeQuesT
User Off Offline

Zitieren
yes.
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
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
1× editiert, zuletzt 09.02.10 19:34:48

alt Re: Lua Scripts/Questions/Help

Anders4000
User Off Offline

Zitieren
Schinken hat geschrieben
yes.
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
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 (:
Zum Anfang Vorherige 1 2159 160 161338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht