Forum
Scripts
Lua Scripts/Questions/Help
.......but i need help making this lua script can you help me?
the features of this plague is like the ZP(ZombiePlague)
....but no nemisis
1.choose bird clases
2.it have ammo packs too like only zp
3.level up to 99
otheres like zp but no nemisis remember
always.........
need help
is me
but i have some parts for fly plague
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
addhook("projectile","hook")
function hook(id,weapon,x,y)
	if (weapon==75) then
		parse("equip "..id.." 75")
		parse("setweapon "..id.." 75")
		parse("setpos "..id.." "..x.." "..y)
	end
end
addhook("spawn","hook_spawn")
function hook_spawn(id)
return "75"
end
Btw: You can avoid making yourself a loop by just using table.concat
1
2
3
4
2
3
4
p_weps = {1,2,3,4,5,6,"etc"}
weapons = table.concat(p_weps," ")
print(weapons)
-->Output: 1 2 3 4 5 6 etc
I tried to make that one first way I thought to.
So new implementation would look like this:
1
2
3
4
5
6
2
3
4
5
6
primary_weapons = {10,11,20,21,22,23,24}
addhook('minute','dm_minute')
function dm_minute()
	msg('Primary Weapons is: '..table.concat(primary_weapons," "))
end
1
weapons = weapons..itemtype(primary_weapons[i], 'name')..' '
edited 1×, last 08.03.10 07:01:15 pm
edited 3×, last 09.03.10 08:36:21 pm
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
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
--Start of SIMPLE Test #1
--Text is a Mandatory parameter, times is not, times default is 1--
local tt=0 --The Times parameter is dependent on this local variable
function say(text,times) --Starts the Function
	if not times or times < 1 then times=1 end
	if not text then error("Error, Text parameter has not been fullfilled.")return end
	--If times parameter less than 1 or does not exist then times=1
	--If Text parameter is not fullfilled, then it returns a error.
	while tt ~= times do --while tt is not (what the times parameter is) it does...
		print(text) --Saying, or Printing the text
		tt=tt+1 --Adds to the local variable tt
	end --ends this part of the function
	if tt==times then --So now, If tt==times it will set tt into zero and end the function.
		tt=0
	return
	end
end --end of full function
--Un-Comment the next line(s) to test it(them). [Delete] off the "--"
--Test 1
--say("Hello, this is Test 1 !",0)
--Test 2
--say("Hello, this is Test 2 !",0.1)
--Test 3
--say("Hello, this is Test 3 !")
--Test 4 (Wrong Parameter use)
--say(Hello this is text 1,0) --There is no quotes around the text, and there is no Variable named "Hello This is text" so it will return NIL and results in error,: ')' expected near 'this'
--END OF SIMPLE Test #1
Dark Byte has written
How to create a menu? I know some about Lua. I just do not know the functions added by CS2D.
here :
1
2
3
4
5
6
2
3
4
5
6
addhook("say","menusay")
function menusay(id,txt)
	if (txt=="text to trigger this menu") then
		menu(id,"Title|alongtext,Button1name|alongtext,Button2name|alongtext...")
	end
end
if you says "your text" then it triggers your menu ...
if you dont know CS2D functions read sys/lua/info.txt
1
2
3
4
5
6
7
2
3
4
5
6
7
addhook("spawn","givesarmor")
function givesarmor(playerid) --Start of "Spawn Hook"
	if player(playerid,"usgn") == USGNID then
		parse("setarmor "..playerid.." 205")
	end
end --End of "Spawn Hook"
Too simple...
setarmor sets how much armor that player has
Armor that is 0 - 200 is
Normal Armor
Armor 201-206 is special armors
201=Light Armor
202=Armor
203=Heavy Armor
204=Medic Armor
205=Super Armor
206=Stealth Suit
setarmor command sets the armor of the player
you need to add parse("equip "..playerid.." 83")
Is this good ? im trying to do it
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("spawn","supersp")
function supersp(id)
	if (player(id,"usgn")) then
		parse ("equip "..id.." 83")
	end
end
supersp = false
addhook("collect","supercoll")
function supercoll(id,x,y)
	if (x==99) and (y==87) then
		if (player(id,"usgn")) then
			supersp = true
		end
	end
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
addhook("spawn","supersp")
function supersp(id)
	[b]if (player(id,"usgn")) then--This sentence will always be true(unless player doesn't exist)[/b]
		parse ("equip "..id.." 83")
	end
end
[b]supersp = true --You are using the same name as your funcion[/b]
addhook("collect","supercoll")
function supercoll[b](id,x,y)--Wrong parameters[/b]
	[b]if (x==99) and (y==87) then --Instead of hardcoding the position, why don't you use item id?[/b]
		[b]if (player(id,"usgn")) then--This always returns true(useless)[/b]
			supersp = true
		end
	end
end
edited 1×, last 11.03.10 06:15:26 pm
It's only possible to make players hear in certain area using sv_sound2
1
parse("sv_sound2 \"snd path\"")
just this?
and can you help me?, i have bug :
1
msg("©255000000'..player(id,"name")..' is noob!")
What's wrong here?
edited 2×, last 11.03.10 08:32:06 pm
DRoNe has written
1
msg([b]"©255000000'[/b]..player(id,"name")..[b]' is noob!"[/b])
If you are starting string with " then you should finish the same.
'string'
"string"
'string"
"string' fixed.
I'm making a big Role-Playing Map and i want a level script how can i make a script like this;
Killing Players Gives Exp
Breaking Breakable things Gives Exp I've another question but first i must know this level script
Lua Scripts/Questions/Help


Offline