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 2182 183 184338 339 Next To the start

old Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Quote
Here's a little function for returning a random result from a table.

function returnRandom(tab)
     return tab[math.random(#tab)]
end

Enjoy. Just specify a table of image names/paths and use this function on it.

old Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Quote
can some1 help me with this script =
1
2
3
4
5
6
addhook("startround","bps")
function bps
	parse("mp_wpndmg Elite 10000")
	parse("mp_wpndmg_z1 Elite 10000")
	parse("mp_wpndmg_z2 Elite 10000")
end

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
Khaleed has written
can some1 help me with this script =
1
2
3
4
5
6
addhook("startround","bps")
function bps
	parse("mp_wpndmg Elite 10000")
	parse("mp_wpndmg_z1 Elite 10000")
	parse("mp_wpndmg_z2 Elite 10000")
end


1
2
3
4
5
6
addhook("startround","bps") 
function bps()
	parse("mp_wpndmg Elite 10000") 
	parse("mp_wpndmg_z1 Elite 10000") 
	parse("mp_wpndmg_z2 Elite 10000") 
end

Dark Byte has written
     why does this not work?
     image("gfx/backgrounds/water4.jpg", 34, 1, 101)


1
image("gfx/backgrounds/water4.jpg",34,1,1)

old Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Quote
This function might be useful to some people, it's to draw a line from one position to another.
You need to transfer a 1x1 image to the client, and use this function:

tbl can consist of :
mode: image mode
width: line width
color: {r, g, b}
alpha: same as imagealpha
blend: same as imageblend

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function drawLine(x1, y1, x2, y2, tbl)
	if not (x1 and y1 and x2 and y2) then
		return false
	end
	tbl = tbl or {}
	local line = image('gfx/weiwen/1x1.png', 0, 0, tbl.mode or 1)
	local x3, y3, rot = (x1+x2)/2, (y1+y2)/2, math.deg(math.atan2(y1-y2, x1-x2))+90
	imagepos(line, x3, y3, rot)
	imagescale(line, tbl.width or 1, math.sqrt((x1-x2)^2+(y1-y2)^2))
	if tbl.color then
		imagecolor(line, tbl.color[1] or 0, tbl.color[2] or 0, tbl.color[3] or 0)
	end
	if tbl.alpha then
		imagealpha(line, tbl.alpha)
	end
	if tbl.blend then
		imageblend(line, tbl.blend)
	end
	return line
end

old Predator Mod HELP

Soja1997
User Off Offline

Quote
Hey im from poland sorry for my bad english
i have one problem
[/code]addhook("spawn","niema")
function niema(spawnplayer)
end
     if (team>1) then
      parse("setmaxhealth "..id.." 250")          
      parse("equip "..id.." 84")          
      parse("equip "..id.." 69")
      parse("speedmod "..id.." 20")                    
end
     if (team>2) then
      parse("equip "..id.." 23")          
      parse("equip "..id.." 30")          
      parse("equip "..id.." 1")
      parse("equip "..id.." 3")
      end[/code]     

its error
Who Can Repair Plz!

old Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("spawn","niema")
function niema(spawnplayer)
	local team = player(spawnplayer,"team")
	if (team==1) then
		parse("setmaxhealth "..id.." 250")          
		parse("equip "..id.." 84")          
		parse("equip "..id.." 69")
		parse("speedmod "..id.." 20")                    
	elseif (team==2) then
		parse("equip "..id.." 23")          
		parse("equip "..id.." 30")          
		parse("equip "..id.." 1")
		parse("equip "..id.." 3")  
	end
end

old Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Quote
Flacko has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
addhook("spawn","niema")
function niema(spawnplayer)
	local team = player(spawnplayer,"team")
	local id = spawnplayer
	if (team==1) then
		parse("setmaxhealth "..id.." 250")          
		parse("equip "..id.." 84")          
		parse("equip "..id.." 69")
		parse("speedmod "..id.." 20")                    
	elseif (team==2) then
		parse("equip "..id.." 23")          
		parse("equip "..id.." 30")          
		parse("equip "..id.." 1")
		parse("equip "..id.." 3")  
	end
end

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
[/code]addhook("spawn","niema")
function niema(spawnplayer)
local team = player(spawnplayer,"team")
local id = spawnplayer
if (team==1) then
parse ("equip "..id.." 69")
parse("setweapon "..id.." 69")
parse("strip "..id.." 2")
parse("setmaxhealth "..id.." 250")
parse("equip "..id.." 84") - stealth suit
parse ("equip "..id.." 59")
parse("speedmod "..id.." 20")
elseif (team==2) then
parse("equip "..id.." 23")
parse("equip "..id.." 30")
parse("equip "..id.." 1")
parse("equip "..id.." 3")
parse("speedmod "..id.." 6")
parse("setmaxhealth "..id.." 150")
parse ("equip "..id.." 79")
end
end[/code]
Terrorist in nextround is visible WTF? HELP
edited 2×, last 04.04.10 11:22:29 am

old Re: Lua Scripts/Questions/Help

goweiwen
User Off Offline

Quote
@Soja1997
from Flacko's

This doesn't give secondary weapons, though.
1
2
3
4
5
6
7
8
9
10
11
addhook("spawn","niema")
function niema(id)
	local team = player(id,"team")
	if (team==1) then
		parse("setmaxhealth "..id.." 250")
		parse("speedmod "..id.." 20")
		return "84,69"
	elseif (team==2) then
		return "23,30,1,3"
	end
end

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
[/code]
-----------------------
-- NO COLLECTING --
-----------------------
addhook("walkover","walkover")
function walkover(id,iid,type)
     if (type>=1 and type<=88) then
          return 0
     end
     return 1
end
[/code]

it don't work players can take weapons and armors why?
edited 1×, last 04.04.10 11:50:16 am

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
-----------------------
-- NO COLLECTING --
-----------------------
addhook("walkover","walkover")
function walkover(id,iid,type)
     if (type>=1 and type<=88) then
          return 0
     end
     return 1
end

it don't work players can take weapons and armors why?

old Re: Lua Scripts/Questions/Help

Admir
User Off Offline

Quote
1
2
3
4
5
6
7
-----------------------
-- NO COLLECTING --
-----------------------
addhook("walkover","walkover")
function walkover(id,iid,type)
	return 0
end

old Menu

Soja1997
User Off Offline

Quote
Can make script Smoking? hmm gen_fx Steam its Smoking can make it?
edited 1×, last 04.04.10 12:21:09 pm

old Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Quote
In cmd type effect "smoke" x y
Replace x and y with your values..
Example:
1
2
3
4
addhook("spawn","mspawn")
function mspawn(id)
	parse("effect \"smoke\" "..(player(id,"x")).." "..(player(id,"y"))) --Create smoke when player spawns
end

old Re: Lua Scripts/Questions/Help

Soja1997
User Off Offline

Quote
Hmm
addhook("spawn","mspawn")
function mspawn(id)
parse("effect \"smoke\" "..(player(id,"x")).." "..(player(id,"y"))) --Create smoke when player spawns
end
can smoke if say !smoke?
?
To the start Previous 1 2182 183 184338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview