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 2180 181 182338 339 Nächste Zum Anfang

alt Re: Lua Scripts/Questions/Help

Night Till Death
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
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
--------------------------------------------------
-- Player Classes Script by Unreal Software     --
-- 28.02.2009 - www.UnrealSoftware.de           --
-- Adds Player Classes to your server           --
--------------------------------------------------

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

-----------------------
-- INITIAL SETUP     --
-----------------------
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array
end
sample.classes.class=initArray(32)
function sample.classes.classmenu(id)
	menu(id,"Select your Class,Soldier|,Spy|,Engineer|,Pyro|,Scout|,Heavy|,Medic|,Demoman|,Sniper|")	
end


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


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


-----------------------
-- CLASS SELECTION   --
-----------------------
addhook("menu","sample.classes.menu")
function sample.classes.menu(id,menu,sel)
	if (menu=="Select your Class") then
		if (sel>=0 and sel<=9) then
			sample.classes.class[id]=sel
			if (player(id,"health")>0) then
				parse("killplayer "..id)
			end
		end
	end
end


-----------------------
-- SPAWN             --
-----------------------
addhook("spawn","sample.classes.spawn")
function sample.classes.spawn(id)
	-- SOLDIER
	if (sample.classes.class[id]<=1) then
		parse ("setmaxhealth "..id.." 175")
		parse ("setarmor "..id.." 202")
		parse ("speedmod "..id.." -5")
msg2(id,"©000255000[TF2D]Current Class:Soldier")
                parse ("strip "..id.." 50")
		return "47,10,51";
	end
	-- SPY
	if (sample.classes.class[id]==2) then
		parse ("setmaxhealth "..id.." 125")
		parse ("equip "..id.." 21")
msg2(id,"©000255000[TF2D]Current Class:Spy")
		parse ("speedmod "..id.." 5")
		return "21,3,84";
	end
	-- ENGINEER
	if (sample.classes.class[id]==3) then
		parse ("setmaxhealth "..id.." 125")
                parse ("strip "..id.." 50")
msg2(id,"©000255000[TF2D]Current Class:Engineer")
		parse ("setarmor "..id.." 75")
		return "10,2,74";
	end
	-- PYRO
	if (sample.classes.class[id]==4) then
		parse ("setmaxhealth "..id.." 155")
                parse ("strip "..id.." 50")
msg2(id,"©000255000[TF2D]Current Class:Pyro")
		parse ("setarmor "..id.." 75")
		return "46,10,73";
	end
	-- SCOUT
	if (sample.classes.class[id]==5) then
		parse ("setmaxhealth "..id.." 125")
		parse ("setarmor "..id.." 0")
                parse ("strip "..id.." 50")
msg2(id,"©000255000[TF2D]Current Class:Scout")
		parse ("speedmod "..id.." 20")
		return "5,11,69";
	end
        -- Heavy
	if (sample.classes.class[id]==6) then
		parse ("setmaxhealth "..id.." 200")
		parse ("equip "..id.." 80")
msg2(id,"©000255000[TF2D]Current Class:Heavy")
                parse ("strip "..id.." 50")
		parse ("speedmod "..id.." -3")
		return "40,10,78";
        end
        -- Medic
	if (sample.classes.class[id]==7) then
		parse ("setmaxhealth "..id.." 100")
                parse ("strip "..id.." 50")
msg2(id,"©000255000[TF2D]Current Class:Medic")
		parse ("equip "..id.." 82")
                parse ("mp_wpndmg Galil 2")
		parse ("speedmod "..id.." 8")
		return "38,85,45";
        end
        -- Demoman
	if (sample.classes.class[id]==8) then
		parse ("setmaxhealth "..id.." 145")
                parse ("strip "..id.." 50")
msg2(id,"©000255000[TF2D]Current Class:Demoman")
		parse ("equip "..id.." 79")
		parse ("speedmod "..id.." 4")
		return "49,77,87"; 
	end
	-- SNIPER
	if (sample.classes.class[id]==9) then
		parse ("setmaxhealth "..id.." 125")
                parse ("strip "..id.." 50")
msg2(id,"©000255000[TF2D]Current Class:Sniper")
		parse ("setarmor "..id.." 75")
		return "35,23,69";
	end
end


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


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


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


-----------------------
-- NO DEAD DROPPING  --
-----------------------
addhook("die","sample.classes.die")
function sample.classes.die()
	return 1
This is DC's code for TF2D i kinda modified but now i have a question how do i keep the msg of what class you are on the players hood and not let it vanish! Also is it possible to infinate ammo only for heavy's m249?

alt Re: Lua Scripts/Questions/Help

YellowBanana
BANNED Off Offline

Zitieren
Szkieletor hat geschrieben
I'd like a script with another money container, so I can have more than 16,000$ at a time. Like the script in [CC]RolePlay server. I've searched the forums for it, but couldn't find one. Can someone help me please?



This is pretty easy stuff.

Just do something like
1
2
3
4
5
6
7
8
9
function initArray(m,v)
     local array = {}
     for i = 1, m do
          array[i]=v
     end
     return array
end

credits = initArray(32,0)

then use hudtxt2 with the credits.
You won't learn anything if you're getting spoonfed every time.

alt Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Zitieren
Is there any way of getting a list of entities?

I need to grab a list of map entities to be looped through, the info text doesn't describe an entity(0,"table") function.

Any help?

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
Fehuziom hat geschrieben
Nice , but:
1
parse('sv_msg2 '..id..' "You have already asked for help, don't spam the forums" ')
is bad..

true is:
1
msg2(id,"You have already asked for help, don't spam the forums")

It's not bad, it's different because they would both work.

Ruirize hat geschrieben
Is there any way of getting a list of entities?

I need to grab a list of map entities to be looped through, the info text doesn't describe an entity(0,"table") function.

Any help?


You will have to loop through the whole map
1
2
3
4
5
6
7
8
ENTITIES = {} --This is your table for entities.
for x=1, map("xsize") do --Maybe It should be x=0? Dunno.
	for y=1, map("ysize") do
		if entity(x,y,"exists") then
			table.insert(ENTITIES,{x,y,typename})
		end
	end
end
And there you can loop through ENTITIES.
1
2
3
4
print("List of tables:")
for i,v in ipairs(ENTITIES) do
	print(v[1]..";"..v[2]..": "..v[3])--ie: 15;3: env_sprite
end

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
anyone can help me with this script please?.
is carmod..

Spoiler >

alt Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Zitieren
Flacko hat geschrieben
Ruirize hat geschrieben
Is there any way of getting a list of entities?

I need to grab a list of map entities to be looped through, the info text doesn't describe an entity(0,"table") function.

Any help?


You will have to loop through the whole map
1
2
3
4
5
6
7
8
ENTITIES = {} --This is your table for entities.
for x=1, map("xsize") do --Maybe It should be x=0? Dunno.
	for y=1, map("ysize") do
		if entity(x,y,"exists") then
			table.insert(ENTITIES,{x,y,typename})
		end
	end
end
And there you can loop through ENTITIES.
1
2
3
4
print("List of tables:")
for i,v in ipairs(ENTITIES) do
	print(v[1]..";"..v[2]..": "..v[3])--ie: 15;3: env_sprite
end


Thanks man.

alt Re: Lua Scripts/Questions/Help

StirlizZ-Fapicon
Super User Off Offline

Zitieren
strakzz

Don`t worry about this. I`m and vectar666 making Rush`n`Crash - it`s like GLOBAL carmod

Somebody have simple infection script? When zombie killed human - human mutated into the zombie. Not die and respawn as zm. MUTATED.

alt Re: Lua Scripts/Questions/Help

Night Till Death
User Off Offline

Zitieren
Fapicon hat geschrieben
strakzz

Don`t worry about this. I`m and vectar666 making Rush`n`Crash - it`s like GLOBAL carmod

Somebody have simple infection script? When zombie killed human - human mutated into the zombie. Not die and respawn as zm. MUTATED.
you mean like Blazzingxx's Zombie Plague Script?

alt Re: Lua Scripts/Questions/Help

Starkkz
Moderator Off Offline

Zitieren
no i'm not using a standard function and
Fapicon..
your car mod it's posible to using it pressing "E"?.
that i'm doing.. , and too one script to steal cars.
but is not easy..
that's my problem images etc..
so i need help.

alt Re: Lua Scripts/Questions/Help

0ito
User Off Offline

Zitieren
someone help me for sound environmental and shopping menu with infection bomb, rage zombie , antidote , armors and weapons?
please help-me FAST!

alt Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Zitieren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
addhook("team","admteam") 
function admteam(id,team) 
usgn = player(id,"usgn") 
ip = player(id,"ip") 
if (team==1) then 
if
(usgn==44711 or ip=="192.168.0.119" or ip=="127.0.0.1")
then 
parse("maket "..id) 
else 
return 1
                
end 
end 
end
i need help
like how i do like
vip_ips{192.168.0.199,...}
and that ??
vip_usgn{44711,...}
please respond lol
its to make less spaces

alt Re: Lua Scripts/Questions/Help

Flacko
User Off Offline

Zitieren
I hope this works
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function table.find(table,value)
	for i,v in ipairs(table) do
		if v == value then
			return true
		end
	end
end

vip_ip = {} --Add these by yourself (remember these must be strings)
vip_usgn={} --Same here, but these ones are numbers

addhook("team","admteam")
function admteam(id,team)
	usgn = player(id,"usgn")
	ip = player(id,"ip")
	if team==1 then
		if table.find(vip_ip,ip) or table.find(vip_usgn,usgn)then
			parse("maket "..id)
		else
			return 1
		end
	end
end

alt Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Zitieren
Flacko hat geschrieben
1
parse("trigger yourentityname")


SQUEE

Thanks buddy. Didn't see it.

use(id,event,data,x,y)
usebutton(id,x,y)
and
trigger(trigger,source)
triggerentity(x,y)
and
attack(id)     
attack2(id,mode)

The difference?
1× editiert, zuletzt 01.04.10 01:03:20

alt Re: Lua Scripts/Questions/Help

siuL
User Off Offline

Zitieren
i have 1 more question like i did smoke granades tele i did download that snow ball hook and edited but 1 question how i make it inf just for terrorist and all weapons inf too
i did know but i did forget

alt Re: Lua Scripts/Questions/Help

CmDark
User Off Offline

Zitieren
@Ruirize

The Difference is that

Trigger(trigger,source)
triggerentity(x,y)

Do Not
Trigger them, They are functions that are
used when they are triggered.

parse("trigger entity")

Does the action, and does not return true,false,name

alt Re: Lua Scripts/Questions/Help

Ruirize
User Off Offline

Zitieren
You're not getting what I mean. I know the difference between a hook and a console command.

use(id,event,data,x,y)
usebutton(id,x,y)


trigger(trigger,source)
triggerentity(x,y)


attack(id)
attack2(id,mode)

What are the differences between these pairs of hooks?
Zum Anfang Vorherige 1 2180 181 182338 339 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht