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 279 80 81338 339 Next To the start

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
Hey, I have a table, and i was wondering, how can I show what it has?
Spoiler >

It said it couldn't concatenate global 'racetable' (a table value)...
edited 1×, last 05.11.09 05:48:31 pm

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

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


OMG 10/10 cooooool xd, without the car graphic it looks excelent, with the car it will be suuuupeer cool

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
Is it possible to do some kind of "waves" something like :
when every zombie dies X times(when zombie dies X times he cant respawn anymore)next wave starts.
sorry for this question but i cant find a way to do this. im not an advanced scripter :S.

old Re: Lua Scripts/Questions/Help

playa slaya
COMMUNITY BANNED Off Offline

Quote
Flacko has written
That way your script will look nicier
But I don't think it will fix your error

wtf, i dont want it to look nicer i want it fixed thx

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
Using serveraction3 for speedmod to player for 7 seconds,
after 7 seconds, he need to wait 7 seconds to cool down, it's like a sprint, is this possible?

old Re: Lua Scripts/Questions/Help

Heartless Soldier
User Off Offline

Quote
Admirdee has written
Using serveraction3 for speedmod to player for 7 seconds,
after 7 seconds, he need to wait 7 seconds to cool down, it's like a sprint, is this possible?


They asked that some times ago i dont remember who xd

old Re: Lua Scripts/Questions/Help

doom15
BANNED Off Offline

Quote
INSURGENCY 2D Project By INSURGENCY

parse('hudtxt 2 "©000255000 (0.05)On/Map/'..game("sv_map")..'" 322 26 1')
if sample==nil then sample={} end
sample.ads={}
addhook("minute","sample.ads.minute")
function sample.ads.minute()
msg("©200255000INSURGENCY 2D")
msg(os.date("©000255000Time: %I:%M %p"));
msg(os.date("©000255000Date: %A, %d %b %Y"));
end
end
end


What is work here !!
Plz can i get anyhelp

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
mat5b has written
@doom15
Do you have (in your script) the function msg?

Fail, it's cs2d function

It's same as
1
parse('sv_msg <txt>')

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
@Blazzingxx
Whut, I always thought it ( msg() ) would be a wrapper function in an additional script file wrapper.lua that sb wrote.

old Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Quote
@mat5b
No, it's cs2d function, you can see it on CS2D functions INFO file.
CS2D FUNCTIONS INFO has written
- msg("text")               send "text" as server message to all


@doom15
Use this script:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("minute","minutes")
function minutes()
	msg("©200255000INSURGENCY 2D")
	msg(os.date("©000255000Time: %I:%M %p"));
	msg(os.date("©000255000Date: %A, %d %b %Y"));
	
end

addhook("team","teams")
function teams()
	msg("©200255000INSURGENCY 2D")
	msg(os.date("©000255000Time: %I:%M %p"));
	msg(os.date("©000255000Date: %A, %d %b %Y"));
	parse('hudtxt 2 "©000255000 (0.05)On/Map/'..game("sv_map")..'" 322 26 1')
end

old Re: Lua Scripts/Questions/Help

BetaM
User Off Offline

Quote
Blazzingxx has written
@mat5b
No, it's cs2d function, you can see it on CS2D functions INFO file.
CS2D FUNCTIONS INFO has written
- msg("text")               send "text" as server message to all


Aww, now I see what do you mean, sorry for confusing your mind

old Re: Lua Scripts/Questions/Help

craza424
User Off Offline

Quote
I need a script....

It need's to do unlimited of every grenade, for 1 id.

Can someone please make this, I've been looking for age's for one!

P.S. I just thought it need's to be set off by me saying "!wep" or "!weps".
edited 1×, last 06.11.09 06:36:59 pm

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
@Slaya:
Fixed
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
function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end

function pickpocket_success(id,source)
	parse("setmoney "..source.." "..player(source,"money")+player(id,"money"))
	parse("setmoney "..id.." 0")
	msg2(source,"©000255000PickPocket Successfull!@C")
	print("Source money: "..player(source,"money")) --> Debugging
	print("Victim money: "..player(id,"money")) --> Here too, you can remove this lines
end

function pickpocket_fail(id,source)
	bounty[source] = bounty[source]+500
	msg2(source,"©255000000PickPocket Failure!@C")
	msg2(id,"©000255000"..player(source,"name").." tried to pickpocket you!@C")
	msg('©255005000'..player(source,'name')..' has a bounty of '..bounty[source]..' !')
end 


function pickpocket(id,source)
	PP = math.random(1, 6)
	if PP<= 3 then
		pickpocket_fail(id,source)
	elseif PP > 3 then
		pickpocket_success(id,source)
	end 
end

addhook("hit","BDX_PP")
function BDX_PP(id,source,weapon)
     if (weapon == 78) then
          pickpocket(id,source)
     end
end

old Re: Lua Scripts/Questions/Help

NozliW
User Off Offline

Quote
@craza424
you want infinite grenades for just 1 id or for everyone ?
Spoiler >

i hope it helped you

old Re: Lua Scripts/Questions/Help

craza424
User Off Offline

Quote
Ok ok.. I'm sick of going in circle's.
Someone make a script which make every grenade infinate to me on id 18662! I CANNOT script!
To the start Previous 1 279 80 81338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview