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 2235 236 237338 339 Next To the start

old Re: Lua Scripts/Questions/Help

head600
BANNED Off Offline

Quote
hi all i need this llua look all

if coming on server admin

right and up screen print

Online Admins:
-XXXXX
-XXXXX

or no online

Online Admins:
Nobody

make this with usgn

and---

i use this but dont work

addhook("hit","deagle_heal")
function deagle_heal(id,source,wpn,hpdmg,apdmg)
if wpn == 3 then
parse("sethealth "..id.." "..player(id,"health")+30)
return 1
end
end

deagle can kill and no up health...
edited 1×, last 19.08.10 11:13:42 pm

old Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Quote
MSek has written
@CS2D_TURKEY you want music at join, right?
1
2
3
4
addhook("join","music_joi")
function music_joi(id)
	parse("sound2 "..id.. "..env/thats_the_way.wav")
end

file env/thats_the_way.wav is example. change it to your music.


That's WRONG.

1
2
3
4
addhook("join","music_joi")
function music_joi(id)
	parse("sound2 "..id.. env/thats_the_way.wav")
end

Why did you added the ".. to the parse function?, it's not necessary.

old script

murilogc
User Off Offline

Quote
i want one script of classes ,

classes

Shop Owner (0/5)
Medic , if txt !gomedic , go to the medic (0/1)
Owner Hotel if txt !gohotel , go to the hotel (0/1)

and text !info show your profession

old Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Quote
Starkkz has written
MSek has written
@CS2D_TURKEY you want music at join, right?
1
2
3
4
addhook("join","music_joi")
function music_joi(id)
	parse("sound2 "..id.. "..env/thats_the_way.wav")
end

file env/thats_the_way.wav is example. change it to your music.


That's WRONG.

1
2
3
4
addhook("join","music_joi")
function music_joi(id)
	parse("sound2 "..id.. env/thats_the_way.wav")
end

Why did you added the ".. to the parse function?, it's not necessary.

that is wrong too

you cant make three """ in the () of the parse

old Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Quote
Here let me fix that for you.

1
2
3
4
addhook("join","music_joi")
function music_joi(id)
     parse("sound2 " .. id .. " env/thats_the_way.wav")
end

old Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Quote
murilogc has written
i want one script of classes ,

classes

Shop Owner (0/5)
Medic , if txt !gomedic , go to the medic (0/1)
Owner Hotel if txt !gohotel , go to the hotel (0/1)

and text !info show your profession


I write it, I test it and it works perect,
I don't know if the translation is okay

I add the possibility to reset the class with !resetclass

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
rp={}

function initArray(m)
     local array = {}
     for i = 1, m do
          array[i]=0
     end
     return array
end

myclass=initArray(32)
shopowners=initArray(1)
medics=initArray(1)
hotelowners=initArray(1)

addhook("say","class_sel")
function class_sel(id,txt)
	if(txt=="!goshop")then
		if(myclass[id]==0)then
			if(shopowners[1]<5)then
				shopowners[1]=shopowners[1]+1
				myclass[id]=1
				msg2(id,"©255255255Congratulations you are a shop owner now!")
				msg("©255255000"..(player(id,"name")).." is a shop-owner now!")
				msg("©000255255Shop-Owners: "..shopowners[1].."/5")
				msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
				msg("©000255255Medics: "..medics[1].."/1")
				return 1
			else
				msg2(id,"©255255255There are already "..shopowners[1].." Shop Owners!")
				return 1
			end
		else
			msg2(id,"©255255255You are already a in a class!")
			return 1
		end
	end
	if(txt=="!gomedic")then
		if(myclass[id]==0)then
			if(medics[1]<1)then
				medics[1]=medics[1]+1
				myclass[id]=2
				msg2(id,"©255255255Congratulations you are a Medic now!")
				msg("©255255000"..(player(id,"name")).." is a medic now!")
				msg("©000255255Shop-Owners: "..shopowners[1].."/5")
				msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
				msg("©000255255Medics: "..medics[1].."/1")
				return 1
			else
				msg2(id,"©255255255There are already "..medics[1].." Medics!")
				return 1
			end
		else
			msg2(id,"©255255255You are already a in a class!")
			return 1
		end
	end
	if(txt=="!gohotel")then
		if(myclass[id]==0)then
			if(hotelowners[1]<1)then
				hotelowners[1]=hotelowners[1]+1
				myclass[id]=3
				msg2(id,"©255255255Congratulations you are a hotel owner now!")
				msg("©255255000"..(player(id,"name")).." is a hotel-owner now!")
				msg("©000255255Shop-Owners: "..shopowners[1].."/5")
				msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
				msg("©000255255Medics: "..medics[1].."/1")
				return 1
			else
				msg2(id,"©255255255There are already "..hotelowners[1].." hotel owners!")
				return 1
			end
		else
			msg2(id,"©255255255You are already a in a class!")
			return 1
		end
	end
	if(txt=="!info")then
		if(myclass[id]==1)then
			msg2(id,"©255255255You are a shop owner!")
			return 1
		elseif(myclass[id]==2)then
			msg2(id,"©255255255You are a Medic!")
			return 1
		elseif(myclass[id]==3)then
			msg2(id,"©255255255Yoau are a hotel owner!")
			return 1
		else
			msg2(id,"©255255255You are a player!")
			return 1
		end
	end
	if(txt=="!resetclass")then
		if(myclass[id]==0)then
			msg2(id,"©255255255You aren't in a class")
			return 1
		elseif(myclass[id]==1)then
			msg2(id,"©255255255Your class is reseted")
			msg("©255255000There is a shop-owner-class avaible again!")
			msg("©000255255Shop-Owners: "..(shopowners[1]-1).."/5")
			msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
			msg("©000255255Medics: "..medics[1].."/1")
			myclass[id]=0
			shopowners[1]=shopowners[1]-1
			return 1
		elseif(myclass[id]==2)then
			msg2(id,"©255255255Your class is reseted")
			msg("©255255000There is a medic-class avaible again!")
			msg("©000255255Shop-Owners: "..shopowners[1].."/5")
			msg("©000255255Hotel-Owners: "..hotelowners[1].."/1")
			msg("©000255255Medics: "..(medics[1]-1).."/1")
			myclass[id]=0
			return 1
		elseif(myclass[id]==3)then
			msg2(id,"©255255255Your class is reseted")
			msg("©255255000There is a hotel-owner-class avaible again!")
			msg("©000255255Shop-Owners: "..shopowners[1].."/5")
			msg("©000255255Hotel-Owners: "..(hotelowners[1]-1).."/1")
			msg("©000255255Medics: "..medics[1].."/1")
			myclass[id]=0
			return 1
		end
	end
end

Greetings from Germany
Robin

old Re: Lua Scripts/Questions/Help

sixpack
User Off Offline

Quote
loooser has written
@hare yes but i need it as script


Create a gameaction, edit it and put for name "CTwin" and for action, CT win.
Add a button and make it trigger "CTwin".

••••••

QUESTION!!!

I want to make a menu. It will be activated when a player says !menu ro with serveraction etc. SOMEHOW!

As far:
addhook("say", "menu.say")
function menu.say(p, txt)
     if(txt=="!menu") then
     
end
end

When the player activates the menu, the menu will have 3 items.

Item 1
Item 2
Item 3

When you click Item1, it will display 9 items.

1
2
3
4
5
6
7
8
9

When you click Item2, it will display 14 items (9 in the first page, 5 in the second with next button).

When you click Item3, it will display 2 buttons.

Items 1-9 are buttons, when you press them, they display one more menu each with some stuff.

Item2 subcategories do nothing. They are just visible.

Item3 subbuttons, print a text like
msg("I am a text")

CAN SOMEONE HELP ME WITH THIS HUGE CODE?
(TONS OF MENUS!)

-=-I am asking this because I don't know how to make a menu. If you teach me that, I will make it myself (at least I will try)-=-

old Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Quote
loooser has written
@hare yes but i need it as script

add two "Func_GameAction" set one to "CT's win" and one to "T's win", call the first one ct_win and the second one t_win.

then these commands work:
1
parse("trigger ct_win")

or

1
parse("trigger t_win")

old Re: Lua Scripts/Questions/Help

HaRe
User Off Offline

Quote
@DaKnOb:

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
if menu==nil then menu={} end
menu={}

addhook("say", "menu.say")
function menu.say(p, txt)
	if(txt=="!menu") then
		function menu.func(id)
	end
end

function menu.func(id)
	menu(id,"Title,Button 1,Button 2,Button 3")
end

addhook("menu","menu.menu")
function menu.menu(id,title,button)
	if title=="Title" then
		if button==1 then
			-- what ever
		elseif button==2 then
			-- what ever 2
		elseif button==3 then
			-- what ever 3
		end
	end
end

old .YeaH.

FiiD
User Off Offline

Quote
Have a question...can any say me where to find a good tutorial for Lua Scripts and have any maked a lua script with infinite ammo but you need to reload...

old Re: Lua Scripts/Questions/Help

Loooser
User Off Offline

Quote
i know that it works with trigger but i want that my script runs on any map without editing it bevore so does someone know how to make a team win through a lua script?

old Re: Lua Scripts/Questions/Help

head600
BANNED Off Offline

Quote
@beckerchen:


this lua is have wrongs


if you medic

and if you exit game

other player if say !gomedic

say already medic



------------------------------
who can make this with ip!?

function InitArray(m,val)
array={}
     for i=1,m do
          array[i]=val
     end
return array
end


if(ppl==nil) then ppl={} end
if(ppl.muted) then ppl.muted={} end

ppl.muted=InitArray(32,0)


addhook("say","ppl.say")
function ppl.say(id,txt)
     if(ppl.muted[id]==1) then
          msg2(id,"©255000000You are muted@C")
          return 1
     end
end

addhook("parse","ppl.muteparse")
function ppl.muteparse(cmd)
     if(string.sub(cmd,1,4)=="mute") then
          local muteid=tonumber(string.sub(cmd,6,string.len(cmd)))
          ppl.muted[muteid]=1
          print("©255255255"..muteid.." is now muted!")
          msg2(muteid,"©255000000You got muted!@C")
          return 1
     end
     
     if(string.sub(cmd,1,6)=="unmute") then
          local muteid=tonumber(string.sub(cmd,8,string.len(cmd)))
          ppl.muted[muteid]=0
          print("©255255255"..muteid.." got unmuted!")
          msg2(muteid,"©000255000You got unmuted!@C")
          return 1
     end
end

i want this with ip plss
edited 1×, last 20.08.10 04:32:26 pm

old Re: Lua Scripts/Questions/Help

beckerchen
User Off Offline

Quote
FiiD has written
Have a question...can any say me where to find a good tutorial for Lua Scripts and have any maked a lua script with infinite ammo but you need to reload...



thats possible with:
1
parse("mp_infammo 1")

in an example:
1
2
3
4
5
6
7
addhook("say","inf")
function inf(id,txt)
	if(txt=="!inf") then
		parse("mp_infammo 1")
		return 1
	end
end

BUT: this script would work for everyone, if any player write !inf, everyone would have infinitive ammo

@head600: oh youre right I doesn't see it

I will fix it when I have a bit time
To the start Previous 1 2235 236 237338 339 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview