You are not logged in.

Dear visitor, welcome to sourceserver.info. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • DeaD_EyE

    Administrator

    You have to register first, to connect to this user.

11

Waffen der Spieler entfernen...

Rating:

by DeaD_EyE, Friday, February 25th 2011, 1:38pm

Waffen restricten? Fehlanzeige!
Viele kennen das Problem. Man hat eine Lieblings-Map wie awp_lego2 oder ähnliches, auf der zwar keine Waffen herumliegen, die Spieler aber von Anfang an eine Deagle, AWP und Messer haben. Viele kennen sicherlich das Plugin Stripper: Source, welches herumliegende Waffen auf einer Map dynamisch entfernen kann, ohne dabei die Map selbst zu ändern.

Als ich damals vor dem Problem stand, habe ich zuerst versucht mit dem Filter einfach weapon_deagle zu entfernen. Leider funktionierte es nicht so ganz wie es sollte. Nachdem ich dann mit dem Befehl stripper_dump eine Dump der ganzen Entities auf der Map hatte, konnte ich mir die näher ansehen.

Durch eine Nachfrage in einem mods-Forum , wurde das Thema wieder aufgerollt. Es scheint wohl im Internet immer noch keine Anleitung dafür zu geben, wie man das umgehen kann.

Nachdem er mir den Dump von der Map zugeschickt hatte, konnte ich daraus einen Filter erstellen.

Dump von awp_lego2
Dabei ging es mir um einen bestimmten Teil:


Interessanter Teil:

Spoiler Spoiler

Source code

1
2
3
4
5
6
7
8
9
10
{
 "origin" "190 -31 356.5"
 "ammo_338mag" "3"
 "weapon_awp" "1"
 "weapon_deagle" "1"
 "ammo_50ae" "35"
 "item_assaultsuit" "1"
 "weapon_knife" "1"
 "classname" "game_player_equip"
 }


Kompletter Auszug:

Spoiler Spoiler

Source code

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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
{
 "world_maxs" "767 1279 278"
 "world_mins" "-733 -1221 -320"
 "detailmaterial" "detail/detailsprites"
 "detailvbsp" "detail.vbsp"
 "maxpropscreenwidth" "-1"
 "skyname" "sky_day01_01"
 "classname" "worldspawn"
 }{
 "origin" "-117 33 358.5"
 "pitch" "0"
 "_ambientHDR" "-1 -1 -1 1"
 "_lightHDR" "-1 -1 -1 1"
 "_ambient" "255 255 255 500"
 "_light" "255 255 255 700"
 "angles" "0 0 0"
 "classname" "light_environment"
 }{
 "origin" "-117 33 333.5"
 "distance" "75"
 "color" "128 128 128"
 "angles" "80 30 0"
 "classname" "shadow_control"
 }{
 "origin" "190 -31 356.5"
 "ammo_338mag" "3"
 "weapon_awp" "1"
 "weapon_deagle" "1"
 "ammo_50ae" "35"
 "item_assaultsuit" "1"
 "weapon_knife" "1"
 "classname" "game_player_equip"
 }{
 "origin" "490.986 -979 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "491.473 -1036 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "427.475 -1036.56 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "426.988 -979.56 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "363 -980.12 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "363.478 -1037.11 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-328.487 -978.89 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-328 -1035.88 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-391.998 -1036.44 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-392.485 -979.44 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-456.473 -980 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-455.995 -1037 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "81.473 -959 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "17.475 -959.56 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "16.988 -902.56 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-47 -903.12 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "-46.522 -960.11 -310.5"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "363.69 1040 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "363 1095.04 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "426.878 1095.42 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "427.567 1040.39 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "491.325 1040.77 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "490.635 1095.81 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-456.31 1040 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-457 1095.04 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-393.122 1095.42 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-392.433 1040.39 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-328.675 1040.77 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-329.365 1095.81 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-46.31 955.189 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "-47 1010.23 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "16.878 1010.61 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "17.567 955.579 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "81.325 955.962 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "origin" "80.635 1011 -310.5"
 "angles" "0 265.698 0"
 "classname" "info_player_terrorist"
 }{
 "maxs.z" "-133.87"
 "maxs.y" "-175.00"
 "maxs.x" "-563.00"
 "mins.z" "-303.87"
 "mins.y" "-205.00"
 "mins.x" "-568.00"
 "classname" "info_ladder"
 }{
 "maxs.z" "-133.87"
 "maxs.y" "264.00"
 "maxs.x" "-563.00"
 "mins.z" "-303.87"
 "mins.y" "234.00"
 "mins.x" "-568.00"
 "classname" "info_ladder"
 }{
 "maxs.z" "-133.87"
 "maxs.y" "-175.00"
 "maxs.x" "602.00"
 "mins.z" "-303.87"
 "mins.y" "-205.00"
 "mins.x" "597.00"
 "classname" "info_ladder"
 }{
 "maxs.z" "-133.87"
 "maxs.y" "264.00"
 "maxs.x" "602.00"
 "mins.z" "-303.87"
 "mins.y" "234.00"
 "mins.x" "597.00"
 "classname" "info_ladder"
 }{
 "maxs.z" "0.00"
 "maxs.y" "33.00"
 "maxs.x" "-17.00"
 "mins.z" "-298.00"
 "mins.y" "28.00"
 "mins.x" "-36.00"
 "classname" "info_ladder"
 }{
 "origin" "83 -902 -309"
 "angles" "0 90 0"
 "classname" "info_player_counterterrorist"
 }{
 "origin" "2 1243 -152.111"
 "angles" "0 0 0"
 "texture" "lego/signature"
 "classname" "infodecal"
 }{
 "origin" "17 -1188 -152.111"
 "angles" "0 0 0"
 "texture" "lego/signature"
 "classname" "infodecal"
 }


Welche Regel jetzt?
Nach einem kurzen Blick in die Anleitung von Stripper: Source habe ich die Regel gefunden:

Spoiler Spoiler

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
modify:
{
	match:
	{	
	"model" "models/props_junk/garbage_metalcan002a.mdl"
	"classname" "prop_physics_multiplayer"
	}
	replace:
	{
	"classname" "hostage_entity"
	}
	delete:
	{
	"model" "models/props_junk/garbage_metalcan002a.mdl"
	}
	insert:
	{
	"scale" "0.99"
	}
}

Für das Vorhaben um die Waffe zu entfernen, die dem Spieler beim Start gegeben wird, benötige ich match, was nach dem Entitie sucht und delete, um aus dem gefundenen Entitie eine Information zu löschen. Das Entitie "game_player_equip" bestimmt also welche Waffen der Spieler am Anfang in der Hand hält.

Die Regel für awp_lego2

Spoiler Spoiler

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
modify:
{
	match:
	{	
	"origin" "190 -31 356.5"
	"ammo_338mag" "3"
	"weapon_awp" "1"
	"weapon_deagle" "1"
	"ammo_50ae" "35"
	"item_assaultsuit" "1"
	"weapon_knife" "1"
	"classname" "game_player_equip"
	}
	delete:
	{
	"weapon_deagle" "1"
	}
}


Nach kurzer Überlegung bin ich darauf gekommen, dass "game_player_equip" nur einmal auf jeder Map vorkommt. Also könnte man die Regel noch weiter vereinfachen:

Spoiler Spoiler

Source code

1
2
3
4
5
6
7
8
9
10
11
modify:
{
	match:
	{
	"classname" "game_player_equip"
	}
	delete:
	{
	"weapon_deagle" "1"
	}
}


Wo kommt der Filter hin?
Nachdem das "MetaMod: Source-Plugin" "Stripper: Source" nach der Anleitung installiert worden ist, kann man sich entscheiden, ob man die Regel global für alle Maps in der Datei addons/stripper/global_filters.cfg festlegt oder ob man eine Mapconfig für eine einzelne Map in addons/stripper/maps/mapname.cfg anlegt. Macht man es über global_filter.cfg sind alle Maps von dem Fix betroffen. Wenn man also mehrere solcher Maps hat, spart man sich durch diese Vorgehensweise viel Zeit. Möchte man die anderen Maps unverändert lassen, so muss man die Mapconfig von Stripper: Source nutzen.

This article has been read 5,027 times.

Tags: entfernen, restricten, Source, stripper, Waffen

Categories: SRCDS


Comments (1)

  • 1

    by Roby (Thursday, April 14th 2011, 1:06pm)

    ldWBM3 Very true! Makes a chagne to see someone spell it out like that. :)

Blog navigation

Next article

ESL-Config Downloader

by DeaD_EyE (Tuesday, March 8th 2011, 8:10pm)

Previous article

Logdateien des SRCDS sortiert nach Datum in Unterverzeichnisse kopieren

by DeaD_EyE (Monday, February 14th 2011, 11:11pm)