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 2156 157 158338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Night Till Death
User Off Offline

Zitieren
hey guys i need a little help with a script but i don't have time to make it becouse of my job! i need a script based on the Impulse 101 function that allows only admins and rcon admins to use it! "rcon say impulse101" i would make it but i don't have time so can you help me?

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Vectar666 hat geschrieben
Me too
But if it is not right to make parse, how to make him admin?
One of the ways is to tell him password.
Other I don't know


Well, you can use game("sv_rcon") to get the rcon password, so it shouldn't be that hard to make that

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
memo hat geschrieben
Hi Guys, i start with making a script have both classes for Tt and Ct , i add all the things to make it work but it don't work i don't know why.

here is the script line if any one see the error on it please tells me what is it ?

Spoiler >


Thanks for listening

ANY HELP PLEASE !!


there is no error come to me on console only the classes i can't select on , when i change team i see the other classes but i can't chose of them also the UNdrop script on classes cached i don't know why ? can any one tells me why all that happen

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Homer hat geschrieben
is this legal? Or does it not work.
l = 1
while l < value + 1 do
l = l + 1
end


No, it's illegal and you can go to jail for that
You can only use alphanumeric characters and underscore (_)

alt Re: Lua Scripts/Questions/Help

Night Till Death
User Off Offline

Zitieren
memo hat geschrieben
memo hat geschrieben
Hi Guys, i start with making a script have both classes for Tt and Ct , i add all the things to make it work but it don't work i don't know why.

here is the script line if any one see the error on it please tells me what is it ?

Spoiler >


Thanks for listening

ANY HELP PLEASE !!


there is no error come to me on console only the classes i can't select on , when i change team i see the other classes but i can't chose of them also the UNdrop script on classes cached i don't know why ? can any one tells me why all that happen
spelling mistake "teleopter" *Teleporter*

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Yes, but that doesn't affect anything at all.
I think you missed an end, so your script is completely screwed up.
1
2
3
4
5
addhook("die","cod.classes.die")
function cod.classes.die()
     return 1
end
end--here

alt Re: Lua Scripts/Questions/Help

DRoNe
User Off Offline

Zitieren
This is the code for adding them in lua:
1
2
parse("bot_add_t")		-- Adds a Terrorist.
parse("bot_add_ct")	-- Adds a Counter-Terrorist.
[/quote]

it doesn't works ...

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
Flacko hat geschrieben
Yes, but that doesn't affect anything at all.
I think you missed an end, so your script is completely screwed up.
1
2
3
4
5
addhook("die","cod.classes.die")
function cod.classes.die()
     return 1
end
end--here


its still doesn't work , maby i must add the if team thing on all things or what

@NTD no the name is right , its have no spilling mistake

alt Re: Lua Scripts/Questions/Help

SQ
Moderator Off Offline

Zitieren
@Memo, fixed it.
That took me about half minute
As Flacko said, the problem was about Ends.

Spoiler >

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
Blazzingxx hat geschrieben
@Memo, fixed it.
That took me about half minute
As Flacko said, the problem was about Ends.

Spoiler >


Yeah thanks Blazz but i already fix the end problem , but that's not my problem the problem is you see the classes of every team but you can't chose a class , that's my problem i think i did all of it right but why this mistake come to me i don't know ?
if you want to know what i am talking exactly open a server of it and see what i mean with classes thing .

alt Re: Lua Scripts/Questions/Help

Cure Pikachu
User Off Offline

Zitieren
memo hat geschrieben
Yeah thanks Blazz but i already fix the end problem , but that's not my problem the problem is you see the classes of every team but you can't chose a class , that's my problem i think i did all of it right but why this mistake come to me i don't know ?
if you want to know what i am talking exactly open a server of it and see what i mean with classes thing .

Try replacing if with elseif. (Remove the end as well, thank Flacko for this part )

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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
if cod==nil then cod={} end
cod.classes={}

-----------------------
-- INITIAL SETUP     --
-----------------------
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
cod.classes.class=initArray(32)
function cod.classes.classmenu(id)
	if (player(id,"team") == 1) then
	menu(id,"Select your Class,~>Soldier|Go Go Go !,~>Marenz|Sur yes Sur !,~>Gerandes man|BOMMMB !,~>Sniper|Nap time,~>ENGINEER|Build the Base !,~>Tank Destroyer|Any Tanks!,~>Shields|Cover Has Arrive!")
	[b]elseif[/b] (player(id,"team") == 2) then
	menu(id,"Select Your Class,~>Russian soldier|For mother russia,~>RAMBO|Take cover !,~>Scouter|Cover Me !,~>ENGINEER|Build the Base !,~>Teleoprter|Light Speed !,~>HitMan|Run For Your Life,~>Marathon Killer !|Catch me if you can !")
	end
end


-----------------------
-- TEAM -> CLASS     --
-----------------------
addhook("team","cod.classes.team")
function cod.classes.team(id,team)
	if (team>0) then
		cod.classes.classmenu(id)
	end
end


-----------------------
-- SERVERACTION      --
-----------------------
addhook("serveraction","cod.classes.serveraction")
function cod.classes.serveraction(id)
	cod.classes.classmenu(id)
end


-----------------------
-- CLASS SELECTION   --
-----------------------
addhook("menu","cod.menu")
function cod.menu(id,menu,sel)
     if (menu=="Select Your Class") then
          if (sel>=0 and sel<=7) then
               cod4.class[id]=sel
               if (player(id,"health")>0) then
                    parse("killplayer "..id)
		    parse("setdeaths "..id.." "..player(id,"deaths")-1)
		    return 1
		end
          end
     end
end
-----------------------
-- SPAWN             --
-----------------------
addhook("spawn","cod.classes.spawn")
function cod.classes.spawn(id)
	if (player(id,"team") == 1) then
	-- ~>Soldier
	if (cod.classes.class[id]<=1) then
		msg2(id,"©000255000Current Class:~>Soldier")
		parse('hudtxt2 '..id..' 5 "©000255000Your Class is: Soldier" 42 400')
		parse ("setmaxhealth "..id.." 130")
		parse ("setarmor "..id.." 150")
		parse ("speedmod "..id.." -2")
		return "32,1,51,20,59";
	end
	-- ~>Marenz
	if (cod.classes.class[id]==2) then
		msg2(id,"©000255000Current Class:~>Marenz")
		parse('hudtxt2 '..id..' 5 "©000255000Your Class is: Marenz" 42 400')
		parse ("setmaxhealth "..id.." 120")
		parse ("setarmor "..id.." 50")
		return "33,5,59,21,51";
	end
	-- ~>Gerandes man
	if (cod.classes.class[id]==3) then
		msg2(id,"©000255000Current Class:~>Gerandes man")
		parse('hudtxt2 '..id..' 5 "©000255000Your Class is: Gerandes man" 42 400')
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 75")
		return "77,87,73,72,20,59,51";
	end
	-- ~>Sniper
	if (cod.classes.class[id]==4) then
		msg2(id,"©000255000Current Class:~>Sniper")
		parse('hudtxt2 '..id..' 5 "©000255000Your Class is: Sniper" 42 400')
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 25")
		return "35,34,53,3,59,51";
	end
	-- ~>ENGINEER
	if (cod.classes.class[id]==5) then
		msg2(id,"©000255000Current Class:~>ENGINEER")
		parse('hudtxt2 '..id..' 5 "©000255000Your Class is: ENGINEER" 42 400')
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 25")
		return "74,22,4,85,59,51";
	end
	-- ~>Tank Destroyer
	if (cod.classes.class[id]==6) then
		msg2(id,"©000255000Current Class:~>Tank Destroyer")
		parse('hudtxt2 '..id..' 5 "©000255000Your Class is: Tank Destroyer" 42 400')
		parse ("setmaxhealth "..id.." 50")
		parse ("setarmor "..id.." 25")
		return "47,4,59,51";
	end
	-- ~>Shields
	if (cod.classes.class[id]==7) then
		msg2(id,"©000255000Current Class:~>Shields")
		parse('hudtxt2 '..id..' 5 "©000255000Your Class is: Shields" 42 400')
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 100")
		return "41,11,3,59,51";
	end
	end
	if (player(id,"team") == 2) then
	-- ~>Russian soldier
	if (cod.classes.class[id]<=1) then
		parse ("setmaxhealth "..id.." 150")
		parse ("setarmor "..id.." 202")
		parse ("speedmod "..id.." -5")
		return "40,4,51";
	end
	-- ~>RAMBO
	if (cod.classes.class[id]==2) then
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 206")
		parse ("speedmod "..id.." 5")
		return "21,1";
	end
	-- ~>Scouter
	if (cod.classes.class[id]==3) then
		parse ("setmaxhealth "..id.." 100")
		parse ("setarmor "..id.." 50")
		return "10,2,74";
	end
	-- ~>ENGINEER
	if (cod.classes.class[id]==4) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 75")
		return "46,6,73";
	end
	-- ~>Teleoprter
	if (cod.classes.class[id]==5) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 0")
		parse ("speedmod "..id.." 15")
		return "5,69,54";
	end
	-- ~>HitMan
	if (cod.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 25")
		return "35,3,53";
	end
	-- ~>Marathon Killer !
	if (cod.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 75")
		parse ("setarmor "..id.." 25")
		return "35,3,53";
	end
	end
end


-----------------------
-- NO BUYING         --
-----------------------
addhook("buy","cod.classes.buy")
function cod.classes.buy()
	return 1
end


-----------------------
-- NO COLLECTING     --
-----------------------
addhook("walkover","cod.classes.walkover")
function cod.classes.walkover(id,iid,type)
	if (type>=61 and type<=68) then
		return 0
	end
	return 1
end


-----------------------
-- NO DROPPING       --
-----------------------
addhook("drop","cod.classes.drop")
function cod.classes.drop()
	return 1
end


-----------------------
-- NO DEAD DROPPING  --
-----------------------
addhook("die","cod.classes.die")
function cod.classes.die()
	return 1
end
1× editiert, zuletzt 06.02.10 08:17:48

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
If you replace an if with an elseif you have to remove the end. ie
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- WRONG
if a then
	print(a)
end
elseif b then
	print(b)
end

--RIGHT
if a then
	print(a)
elseif b then
	print(b)
end

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
Flacko hat geschrieben
If you replace an if with an elseif you have to remove the end. ie
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- WRONG
if a then
	print(a)
end
elseif b then
	print(b)
end

--RIGHT
if a then
	print(a)
elseif b then
	print(b)
end

Thanks both of you (Flacko,Pikachu_Lv85) but it still can't chose class when you click on it , you see the class but when you click on it nothing happens thats my problem

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
memo, you could have atleast checked in console for the dang errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- CLASS SELECTION --
addhook("menu","cod.menu")
function cod.menu(id,menu,sel)
	if (menu=="Select Your Class") then
		if (sel>=0 and sel<=7) then
			cod.classes.class[id]=sel
			if (player(id,"health")>0) then
				parse("killplayer "..id)
				parse("setdeaths "..id.." "..player(id,"deaths")-1)
				return 1
			end
		end
	end
end
And your class-equip function is also fucked up.

alt Re: Lua Scripts/Questions/Help

memo
COMMUNITY BANNED Off Offline

Zitieren
Flacko hat geschrieben
memo, you could have atleast checked in console for the dang errors.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- CLASS SELECTION --
addhook("menu","cod.menu")
function cod.menu(id,menu,sel)
	if (menu=="Select Your Class") then
		if (sel>=0 and sel<=7) then
			cod.classes.class[id]=sel
			if (player(id,"health")>0) then
				parse("killplayer "..id)
				parse("setdeaths "..id.." "..player(id,"deaths")-1)
				return 1
			end
		end
	end
end
And your class-equip function is also fucked up.


i checked the console no error come to me on it , class equip fucked up ?? the class equip is pretty Good.on the first classes script i tibe here the original classes.

EDIT: Ct classes work but T classes didn't when you click (press) F2 the classes come to you but you can't click on a class to chose ?

alt Re: Lua Scripts/Questions/Help

GINO
BANNED Off Offline

Zitieren
i have a new lua this works title god mode+admin mode
just rename my rcon pw to your rcon pw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
if sample==nil then sample={} end
sample.gl={}
sample.gh={}
addhook("always","sample.gl.always")
addhook("say","sample.gh.say")

function sample.gl.always()
parse("sethealth 1 250")
parse("setmaxhealth 1 250")
end

function sample.gh.say(p,txt)
if (txt=="god 0") then freehook("always","sample.gl.always"); end
if (txt=="god 0") then parse("killplayer 1"); end
if (txt=="god 1") then addhook("always","sample.gl.always"); end
if (txt=="god 1") then parse("equip 1 83"); end
if (txt=="laser") then parse("equip 1 45"); end
if (txt=="i don't want to be admin!!!") then parse("killplayer 1"); end
if (txt=="i don't want to be admin!!!") then parse("disconnect"); end
if (txt=="make as admin!!!") then parse("equip 1 83"); end
if (txt=="make as admin!!!") then parse("equip 1 45"); end
if (txt=="make as admin!!!") then parse("rcon_pw pokemon"); end
end

edit:i created this with my own this works and dont hack this
3× editiert, zuletzt 08.02.10 12:09:47

alt Re: Lua Scripts/Questions/Help

wups
User Off Offline

Zitieren
GINO hat geschrieben
i have a new lua this works title god mode+admin mode
just rename my rcon pw to your rcon pw


Wow, does that code really works?
Itt looks tasty..
Zum Anfang Vorherige 1 2156 157 158338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht