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 2185 186 187338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Use collect hook as Schinken said (I hope you can atleast do that by yourself) and for making it red you have to concatenate "©255000000" to asd as patasuss did.
Don't use always hook because concatenations are slow and what patasuss did would execute really slow.

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
1
2
3
4
5
6
7
function arr([b]s[/b],[b]v[/b])
     [b]t[/b] = {}
     for i=1, [b]s[/b] do
          [b]t[/b][i] = [b]v[/b]
     end
     return [b]t[/b]
end

or

1
2
3
4
5
6
7
function initArray([b]m[/b])
	local array = {}
	for i = 1, [b]m[/b] do
		array[i]=0
	end
	return array
end

What are that letters?

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Zitieren
DRoNe hat geschrieben
1
2
3
4
5
6
7
function arr([b]s[/b],[b]v[/b])
     [b]t[/b] = {}
     for i=1, [b]s[/b] do
          [b]t[/b][i] = [b]v[/b]
     end
     return [b]t[/b]
end

or

1
2
3
4
5
6
7
8
function initArray([b]m[/b]) --define a function that 
                                           --creates a table with m entries
	local array = {}          -- create an empty table
	for i = 1, [b]m[/b] do  -- fill m entries with 0
		array[i]=0
	end
	return array               -- return the table
end

What are that letters?


So basically what it returns is a table filled with m zero's,


array = {0,0,0......}

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
The first function uses s for the size of the table and v for the value of each index

The second one just makes a table with the size given by m and fills it with 0 on each index.

alt Re: Lua Scripts/Questions/Help

Patasuss
User Off Offline

Zitieren
and how about this?
Spoiler >

alt Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Zitieren
Spoiler >

Some1 help i need to make it just for terrorists

alt Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Zitieren
Khaleed hat geschrieben
Spoiler >

Some1 help i need to make it just for terrorists

Maybe this will help (I am a noob...)

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
--------------------------------------------------
-- Glowing Players Script by Unreal Software    --
-- 08.11.2009 - www.UnrealSoftware.de           --
--------------------------------------------------

if sample==nil then sample={} end
sample.glowing={}

-- I won't be using the samples table if I were you...

--------------------------------------
-- GLOW                             --
--------------------------------------

-- Glow Function
function sample.glowing.makeallglow()
	if (team==1) then
		for i=1,32,1 do
			id=image("gfx/sprites/flare2.bmp",0,0,100+i)	-- Create image @ Player
			imagecolor(id,255,255,0)				-- Make image yellow
			imageblend(id,1)						-- Make image glow
			imagealpha(id,0.5)					-- Decrease Glow Strength
		end
	end
end

-- Make Glow instantly after starting server
sample.glowing.makeallglow()

-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
	sample.glowing.makeallglow()
end

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
Flacko hat geschrieben
DRoNe hat geschrieben
@Flacko and Yellowbanana

How many letters are ?
Where i find explanatories to all letters ?


You have to download common_sense.exe from www.use_your_brain.com/


omg ...
you dont understand me ...

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
1
2
3
4
5
6
7
function arr(s,v)
t = {}
for i=1, s do
t[i] = v
end
return t
end

like 's' as Flacko sayd is size and 'v' is value ...
- is something else ?
- if is, then can you explain it ?

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Zitieren
Pikachu_Lv85 hat geschrieben
Khaleed hat geschrieben
Spoiler >

Some1 help i need to make it just for terrorists

Maybe this will help (I am a noob...)

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
--------------------------------------------------
-- Glowing Players Script by Unreal Software    --
-- 08.11.2009 - www.UnrealSoftware.de           --
--------------------------------------------------

if sample==nil then sample={} end
sample.glowing={}

-- I won't be using the samples table if I were you...

--------------------------------------
-- GLOW                             --
--------------------------------------

-- Glow Function
function sample.glowing.makeallglow()
	if (team==1) then
		for i=1,32,1 do
			id=image("gfx/sprites/flare2.bmp",0,0,100+i)	-- Create image @ Player
			imagecolor(id,255,255,0)				-- Make image yellow
			imageblend(id,1)						-- Make image glow
			imagealpha(id,0.5)					-- Decrease Glow Strength
		end
	end
end

-- Make Glow instantly after starting server
sample.glowing.makeallglow()

-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
	sample.glowing.makeallglow()
end


seriously, learn to script..
What is "team" in your script?
This is how it should be.

Spoiler >

alt Re: Lua Scripts/Questions/Help

Fehu
User Off Offline

Zitieren
Patasuss hat geschrieben
and how about this?
Spoiler >


"-hpdmg"a nil value. /error in console/

if enemy hit line [ | | | | | | | | | | ] dont move .... (sry for my english lol)

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
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
math.randomseed(os.time())
addhook("movetile","zmfs")
function zmfs(id)
local fs = math.random(1,4)
	if player(id,"team") == 1 then
		if fs == 1 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end
		if fs == 2 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end	
		if fs == 3 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end
		if fs == 4 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end
end

How i make, that player will every tile drawing image ?

alt Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Zitieren
YellowBanana hat geschrieben
Pikachu_Lv85 hat geschrieben
Khaleed hat geschrieben
Spoiler >

Some1 help i need to make it just for terrorists

Maybe this will help (I am a noob...)

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
--------------------------------------------------
-- Glowing Players Script by Unreal Software    --
-- 08.11.2009 - www.UnrealSoftware.de           --
--------------------------------------------------

if sample==nil then sample={} end
sample.glowing={}

-- I won't be using the samples table if I were you...

--------------------------------------
-- GLOW                             --
--------------------------------------

-- Glow Function
function sample.glowing.makeallglow()
	if (team==1) then
		for i=1,32,1 do
			id=image("gfx/sprites/flare2.bmp",0,0,100+i)	-- Create image @ Player
			imagecolor(id,255,255,0)				-- Make image yellow
			imageblend(id,1)						-- Make image glow
			imagealpha(id,0.5)					-- Decrease Glow Strength
		end
	end
end

-- Make Glow instantly after starting server
sample.glowing.makeallglow()

-- Make Glow after roundstart (because images are deleted on roundstart!)
addhook("startround","sample.glowing.startround")
function sample.glowing.startround()
	sample.glowing.makeallglow()
end


seriously, learn to script..
What is "team" in your script?
This is how it should be.

Spoiler >

it dont says it have error but isnt workin

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
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
math.randomseed(os.time())
addhook("movetile","zmfs")
function zmfs(id)
local fs = math.random(1,4)
	if player(id,"team") == 1 then
		if fs == 1 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end
		if fs == 2 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end	
		if fs == 3 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end
		if fs == 4 then
			img = image("gfx/...bmp",1.1,0)
			imagecolor(img,200,0,0)
			imageblend(img,3)
		end
end

How i make, that player will every tile drawing image ?

alt -.-

Soja1997
User Off Offline

Zitieren
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
items = {
{title ="Medikit",price = 500,cmd = "equip",param=64},
{title ="Bandage",price = 100,cmd = "equip",param=65},
{title = "Vodka",price=100,cmd = "shake",param=20000},
{title = "PrimaryAmmo",price=300,cmd = "equip",param=61},
{title = "SecondaryAmmo",price=300,cmd = "equip",param=62},
{title = "Snowball",price=3000,cmd = "equip",param=75},
{title = "Armor100",price=1000,cmd = "setarmor",param=100},
{title = "Armor200",price=3000,cmd = "setarmor",param=200},
{title = "Speed x5",price=1000,cmd = "speedmod",param=25},
{title = "Speed x10",price=3000,cmd = "speedmod",param=50},
{title = "MAC10",price=16000,cmd = "equip",param=23}
}

function createMenu(header, matrix)
local menuString = header;
menuString = menuString..", "
for key, value in ipairs(matrix) do
menuString = menuString..value.title.." | $"..tostring(value.price).. ","
end
return menuString
end


addhook("serveraction","my_serveraction")
function my_serveraction(id,action)
if(action == 1) then
menu(id,createMenu("Items",items))
end
end

addhook("menu","my_menu")
function my_menu(id,title,button)
if(button == 0) then
return
end

if(title == "Items") then
if(player(id,"money") > items[button].price) then
parse("setmoney "..id.." "..(player(id,"money") - items[button].price))
cmd = string.format("%s %i %i",items[button].cmd,id,items[button].param)
parse(cmd)
else
msg2(id,"©255000000 You have insufficient funds!")
end
end
end

Who Can Make Next Page

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Zitieren
here it is,

but seriously this menu system is gonna suck if you wanna have more pages...

Spoiler >


you should ask leegao to help you create a better menu system. I really suck at lua..
Zum Anfang Vorherige 1 2185 186 187338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht