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 2286 287 288338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Zitieren
loooser hat geschrieben
Can some one halp me with this
1
2
3
4
5
6
7
addhook("objectdamage","objectdamage")
function objectdamage(id,damage,player)
if player(player,"team")==object(id,"team") then
parse("killobject "..id)
parse("spawnobject "..object(id,"type").." "..(object(id,"tilex")+1).." "..object(id,"tiley").." 0 0 "..object(id,"team").." "..object(id,"player"))
end
end

thats what the consol sais
LUA ERROR: sys/lua/server.lua:3:attempt to call local 'player'(a number value)

try this
1
2
3
4
5
6
7
addhook("objectdamage","objectdamage")
function objectdamage(id,damage,i)
	if player(i,"team") == object(id,"team") then
		parse("killobject "..id)
		parse("spawnobject "..object(id,"type").." "..(object(id,"tilex")+1).." "..object(id,"tiley").." 0 0 "..object(id,"team").." "..object(id,"player"))
	end
end

alt Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Zitieren
How exactly do I use timer function in this case:

1
2
3
4
5
6
7
8
function spahsappin(obj,dmg,id)
	if (player(id,"weapontype")==78) then
		if issapped[obj]==false then
			issapped[obj]=true
			timer(5000,killobject(obj))
		end
	end
end

I tried to do it like that, but it didn't work. Where did I go wrong? Thanks in advance.

alt Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Zitieren
1
timer(5000,"parse","killobject "..obj,1)
"..obj,1" the 1 means that the timer will turn on just 1 time

,

if you put 2 it will loop

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
1. Does anybody has a lua script like the one on the Happy Camper's map voting one? It it on his servrr HC // Construction

2. How to trigger an entity at every startround? Can u give me the code?

Thanks!
1× editiert, zuletzt 22.10.10 10:44:42

alt Re: Lua Scripts/Questions/Help

Tajifun
User Off Offline

Zitieren
You could just use "trigger_start", couldn't you?

Else:
1
2
3
4
addhook("startround","trigger_on_start")
function trigger_on_start(mode)
	parse("trigger NAME")
end

Should work.

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Hi guys

Is it possible to get radians of two positions ...
I mean if the first position is x=2 y=1 and the second x=3 y=1
then rad is 90 because if you match positions with a line the rotation of line would be 90 degrees but how to make?

pls help

alt Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
dynwall=0
addhook("say","dynwall")
function dynwall(id,txt)
     if dynwall==0 then
          if txt=="hello" or txt=="Hello" or txt=="hi" or txt=="Hi" or txt=="Hia" or txt=="hia" then
               parse("trigger dynwall")
               dynwall=1
          end
     end
end

Ok i got this code so now my question can some one edit this so after you say the word the dynwall goes away but i want also that it plays a sound so can anyone edit this for me so it plays also a sound

alt Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Zitieren
Tajifun hat geschrieben
You could just use "trigger_start", couldn't you?

Else:
1
2
3
4
addhook("startround","trigger_on_start")
function trigger_on_start(mode)
	parse("trigger NAME")
end

Should work.


Thanks its working now

alt Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Zitieren
jaso55 hat geschrieben
1
2
3
4
5
6
7
8
9
10
dynwall=0
addhook("say","dynwall")
function dynwall(id,txt)
     if dynwall==0 then
          if txt=="hello" or txt=="Hello" or txt=="hi" or txt=="Hi" or txt=="Hia" or txt=="hia" then
               parse("trigger dynwall")
               dynwall=1
          end
     end
end

Ok i got this code so now my question can some one edit this so after you say the word the dynwall goes away but i want also that it plays a sound so can anyone edit this for me so it plays also a sound

1
2
3
4
5
6
7
8
9
10
11
dynwall=0
addhook("say","dynwall")
function dynwall(id,txt)
     if dynwall==0 then
          if txt=="hello" or txt=="Hello" or txt=="hi" or txt=="Hi" or txt=="Hia" or txt=="hia" then
               parse("trigger dynwall")
		parse("sv_sound 'sfx/sound.wav'")
               dynwall=1
          end
     end
end

alt Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Zitieren
Hmm the script doesnt seems to work i called the wall dynwall but when i say hello or hi or whatever it doesnt go away..

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Hi guys

Is it possible to get radians of two positions ...
I mean if the first position is x=2 y=1 and the second x=3 y=1
then rad is 90 because if you match positions with a line the rotation of line would be 90 degrees but how to make?

pls help

alt Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Zitieren
Snake_Eater hat geschrieben
Hi guys

Is it possible to get radians of two positions ...
I mean if the first position is x=2 y=1 and the second x=3 y=1
then rad is 90 because if you match positions with a line the rotation of line would be 90 degrees but how to make?

pls help


What? Do you even know the difference between radians and degrees? Because you are talking about 90 (!) radians here.

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Ok, it was a mistake but common sense have to say you what I mean, right?

Ok again....

Hi guys

Is it possible to get radians of two positions ...
I mean if the first position is x=2 y=1 and the second x=3 y=1
then radians is 90 because if you match positions with a line the rotation of line would be 90 radians but how to make?

pls help

alt Re: Lua Scripts/Questions/Help

Triple H
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("endround","playsound") 

sound1 = 0
sound2 = 0

function playsound(m)
     if m==1 or 40 or 50 then 
          parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2.CoN_(FFA)(4FUN)/ct20.wav\"")
               sound2 = sound2 + 1
          if (sound2 == 3) then sound2 = 0 end
     elseif m==2 or 41 or 51 then 
          parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1.CoN_(FFA)(4FUN)/nrs2.wav\"") 
               sound1 = sound1 + 1
          if (sound1 == 3) then sound1 = 0 end
     end 
end

This should work but it doesn't only thing i know is that I must separate file paths

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Snake_Eater hat geschrieben
Is it possible to get radians of two positions ...
I mean if the first position is x=2 y=1 and the second x=3 y=1
then radians is 90 because if you match positions with a line the rotation of line would be 90 radians but how to make?


Wtf... 90 radians? You know that radians go from -pi to pi, right?
You have to use math.atan2(), google that, search the manual etc.

alt Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Zitieren
Oh that would be good for me too... but
I am not good in english so...

could you give me one sample how to get radians(-pi - pi)

if player1 x=500 and y==500 and player2 x == 1000 and y == 500

that would be helpfull for me ...

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
math.atan2(player1y-player2y, player1x-player2x)
Returns radians.
Use math.deg() if you want to transform them to degrees.
1× editiert, zuletzt 22.10.10 19:38:20

alt Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Zitieren
Just use No_weapons entity in map or

1
2
3
4
addhook("spawn","nowep")
functionnowep(id)
parse("strip..id")
end

Dont know if this works i wrote this in 30 seconds didnt checked...
Zum Anfang Vorherige 1 2286 287 288338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht