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 2172 173 174338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

GINO
BANNED Off Offline

Zitieren
I need help about a new cs2d mod if we have ZP = we have FP too Fp=Fly Fly plague =Zp=Zombie Plague

.......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
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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
@Oleg58300: Oh nice, you could have just said "I want somebody to fix this shit for me, fuck your suggestions and clues"
Btw: You can avoid making yourself a loop by just using table.concat
1
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

alt Re: Lua Scripts/Questions/Help

Fasttt
User Off Offline

Zitieren
@Flacko I'm sorry, but always easier to get a solution as a ready example, isn't it? I tried to implement your proposal, but Blazzingxx's example was more faithful

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
Nah, I think the one that Flacko posted is better
I tried to make that one first way I thought to.

So new implementation would look like this:
1
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

alt Re: Lua Scripts/Questions/Help

Fasttt
User Off Offline

Zitieren
for me the first option is more suitable solution because you can use this code:
1
weapons = weapons..itemtype(primary_weapons[i], 'name')..' '
and message would have names of weapons, not simple numbers
1× editiert, zuletzt 08.03.10 20:01:15

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
How i do it if i collect SuperArmor (id 83) + save(if usgn) equip with superarmor(if join or die) ? i don't know this ...
3× editiert, zuletzt 09.03.10 21:36:21

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
I Would like to post a friggin easy script...

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
--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

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
Dark Byte hat geschrieben
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
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

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
@DRoNe That's pretty simple

1
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

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
But i need this to save it and load if leave ...

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
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

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
That's wrong, here I marked your errors, but I think you have the idea, you're just scripting it wrong.
1
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
1× editiert, zuletzt 11.03.10 19:15:26

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
No it's not possible because CS2D sound functions doesn't have that.

It's only possible to make players hear in certain area using sv_sound2

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
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?
2× editiert, zuletzt 11.03.10 21:32:06

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
DRoNe hat geschrieben
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'

alt Re: Lua Scripts/Questions/Help

byengul
User Off Offline

Zitieren
Hi guyz;

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
Zum Anfang Vorherige 1 2172 173 174338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht