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 277 78 79338 339 Next To the start

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@CmDark,
It's very similar to this.
I think you get it from one of my friends >.>
+ In video you said you made it with someone... Me? LOL

Press serverations to control speed.
Spoiler >

@Flacko
Yea, it has same radian function.

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
Spoiler >


The score doesn't count, but the rest of the scripts works (you can win), so what is wrong?

EDIT: oh, it was the hudtxt that didn't show the score changes...
edited 1×, last 03.11.09 06:20:43 pm

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
CmDark has written
A mod i made,

heres the link to the awesome video of the mod

=P

http://www.youtube.com/watch?v=rBrmQvEEvk4

if it says not processed yet(sorry)


1) its cool but isnt awesome cause u copied flacko's code and just added the fire tail...
2) and... can u help me Balzzing? please

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
playa slaya has written
1
2
3
4
-- insted of "timer = 0" you need
timer = initArray(32)
-- and when you change/increase the value
timer[id]=1

Spoiler >

i get an error that says :
"LUA ERROR : sys/lua/asdf.lua:17: attempt to concatenate local 'weapon' (a nil value)"
What's my error now ?

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
I already see the problem.
Attack hook doesn't have weapon parameter.
1
2
addhook("attack","at")
function at(p,wp)
DCs Info has written
attack(id)                              on attack
-id: player id


Oh, yea... USE TABS!

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
HEY i did it:

addhook("move","detect")
function detect(id,walk)
if (walk==1) then
parse("sv_msg2 " ..id.. " You are walking @C")
end
end

Debug doesnt give any mistakes but it doesnt
do nothing when i walk!
what is wrong?
thank you!

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
@N-B-K

you don't need the parse near the msg2

1
parse("sv_msg2 " ..id.. " You are walking @C")

the msg should like this:

1
msg2(id,"You are walking @C")

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
@blazzing i dint know u made a script like that
     anyway i just got bored and messed with the function flacko did =p .. yeah flacko i did use your 'function'

any way ima make a

newb lua thangy for newb lua scripters(im one too)

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
Admirdee has written
@N-B-K

you don't need the parse near the msg2

1
parse("sv_msg2 " ..id.. " You are walking @C")

the msg should like this:

1
msg2(id,"You are walking @C")


ty for ur answer, i tried it but didnt work

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
playa slaya has written
you used "if (walk == 1)"
try holding shift while you move or take this part out


the idea is detect when the player walks... but i hold shift (walk xd) and nothing happen...

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Ladies and gentlemen, I'm proud to present you the Lua script that I will use for making cars in next CS2D version.
It was born in a very dark and rainy night of chips and heavy metal, in 10 minutes.
Enjoy
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function initarray(s,v)
	local asd={}
	for i=1,s do
		asd[i]=v
	end
	return asd
end

function standardangle(angle)
	if (angle<-90) then
		angle = (angle + 360)
	end
	return math.rad(math.abs( angle + 90 ))-math.pi
end

function doublerad(angle)
	return angle + math.pi
end
function singlerad(angle)
	return angle - math.pi
end

ship_rotation = initarray(32,0)

addhook("always","rotateplayers")
function rotateplayers()
	for p in ipairs( player(0,"table") ) do
		if(player(p,"health")>0 ) then
			local pl_rot = doublerad(  standardangle( player(p,"rot") )  )
			local sp_rot = doublerad(  ship_rotation[p]  )
		
			if(pl_rot > sp_rot) then
				if(pl_rot - sp_rot <= math.pi) then
					sp_rot = sp_rot + 0.05
				elseif(pl_rot - sp_rot > math.pi) then
					sp_rot = sp_rot - 0.05
				end				
			elseif(pl_rot < sp_rot) then
				if(sp_rot - pl_rot <= math.pi) then
					sp_rot = sp_rot -0.05
				elseif(sp_rot - pl_rot > math.pi) then
					sp_rot = sp_rot + 0.05
				end
			end
		
			if(sp_rot < 0) then sp_rot = sp_rot + (math.pi*2) end --Correct the angle if it is less than 0
			if(sp_rot > math.pi*2) then sp_rot = sp_rot - (math.pi*2) end --Correct the angle if it is more that 2*Pi
		
			sp_rot = singlerad( sp_rot )
		
			local x = player(p,"x") + math.cos(sp_rot)*4
			local y = player(p,"y") + math.sin(sp_rot)*4
			if(x >= 0 and y >= 0) then
				if(x <= map("xsize")*32 and y <= map("ysize")*32) then
					parse("setpos "..p.." "..x.." "..y)
				end
			end
			ship_rotation[p]=sp_rot
		end
	end
end

It's like the snippet that blazing posted, but this one has a smooth rotation
edited 2×, last 04.11.09 05:26:57 am

old Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Quote
ima test that out lol
^ ^
@flacko

xd


Edit: Tested your script flacko..
     it kinda killed my console =D
          My console went blank from using ur script
               nice work man

but the wierd rotation when you stand still kinda wierd
edited 1×, last 04.11.09 04:39:57 am

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
CmDark has written
Edit: Tested your script flacko..
it kinda killed my console =D
My console went blank from using ur script
nice work man

Oh lol, forgot about that, fixed.

CmDark has written
but the wierd rotation when you stand still kinda wierd

I know, just imagine a car sprite over your player

old !! IMPORTANT !!

CmDark
User Off Offline

Quote
@flacko - Car sprite Lol that gunna still be wierd since u stuck rotating around with a car sprite on top of you
but ill watch out for that ! lol

btw

I haven't tested this anti-NON-DC script

cause this wierd kid speedhacking using name= DC

so i kinda did this try it please =D

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
addhook("join","antiDC")
		function antiDC(id)

admins = {[1]=true,}
adminname = DC

pl = player(p,"name")
usgn = player(p,"usgn")


          if admins[player(id,"usgn")] and adminname[player(id,"name")] then
			msg("©255255000This is the real DC!")
			else
		  if adminname[player(id,"name")] and pl==0 then
		   parse("kick "..id)
		    else
		  if adminname[player(id,"name")] and pl>1 then
		   parse("setname "..id.." Not DC")
		   end
	    end
	end
end

Tell me if it works
edited 3×, last 04.11.09 06:03:38 am

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
Try this
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
admins = 1
adminname = "DC"

addhook("join","antiDC")
function antiDC(id)
	local pl = player(id,"name") --store player's name
	local usgn = player(id,"usgn") --store player's usgn
	
	if admins==usgn and adminname==pl then
		msg("©255255000This is the real DC!") --Alert everyone that the true DC is in ur server
	else
		if adminname==pl and usgn==0 then --If the player's name is DC and he hasn't got any USGN acc then
			parse("kick "..id)    --Kick teh n00b
		elseif adminname==pl and usgn>1 then --If the player's name is DC and he has got an USGN acc then
			parse("setname "..id.." Not DC")  --Change his name
		end
	end
end
edited 1×, last 04.11.09 07:24:12 am
To the start Previous 1 277 78 79338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview