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 2286 287 288338 339 Next To the start

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
loooser has written
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

old Re: Lua Scripts/Questions/Help

EngiN33R
Moderator Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
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!
edited 1×, last 22.10.10 10:44:42 am

old Re: Lua Scripts/Questions/Help

Tajifun
User Off Offline

Quote
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.

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

maPmaKer
User Off Offline

Quote
Tajifun has written
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

old Re: Lua Scripts/Questions/Help

TDShuft
User Off Offline

Quote
jaso55 has written
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

old Re: Lua Scripts/Questions/Help

Jaso
BANNED Off Offline

Quote
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..

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Banaan
User Off Offline

Quote
Snake_Eater has written
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.

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Triple H
User Off Offline

Quote
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

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Snake_Eater has written
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.

old Re: Lua Scripts/Questions/Help

Snake_Eater
User Off Offline

Quote
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 ...

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
math.atan2(player1y-player2y, player1x-player2x)
Returns radians.
Use math.deg() if you want to transform them to degrees.
edited 1×, last 22.10.10 07:38:20 pm

old Re: Lua Scripts/Questions/Help

Rainoth
Moderator Off Offline

Quote
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...
To the start Previous 1 2286 287 288338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview