Forum
Scripts
Sammelthread/FAQ zu Lua & Editor
dofile("sys/lua/equip.lua")
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
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
-------------------------------------------------------------------
-- Utility: equip() Rewrite. Includes auto stripping. --
-- 31.03.2009 - http://amx2d.co.cc/ - AMX2D Scripting --
-- Author - Lee Gao
-------------------------------------------------------------------
--[[--
**INFO:**
This rewrite of the equip() function automatically
strips all of the conflicting weapons so the weapons
do not overlap. IE: No more of having an AK47 and a M4A1
at the same time.
**USAGE:**
Copy equip.lua (This file) into the sys/lua/ folder
In server.lua, add: dofile("sys/lua/equip.lua")
Equiping: equip(Player, Weapon(Name or ID), NoConflicts)
*Example:*
Player 1 has AK47, Deagle, HE, and Knife.
Do
	equip(1, "M4A1", true) leads to
Result: M4A1, Deagle, HE, and Knife
Do
	equip(1, "Laser", false) or equip(1, "Laser") leads to
Result: Laser, M4A1, Deagle, HE, and Knife.
--]]--
--###################################--
--############ Conditions ###########--
--###################################--
if not amx2d then
	print("Please read the comment on AMX2D exclusive features.")
end
if not equip then dofile("sys/lua/wrapper.lua") end
if not Knife then
	print("Please include Kiffer-Opa's Weapon list.")
	-- Author: Kiffer-Opa
	-- Melee Weapons
	Knife =50;
	Machete =69;
	Wrench =74;
	Claw =78;
	Chainsaw =85;
end
if not trim then
	--[[--
	If trim has not already been declared then just return the
	string and warn developers that they must not add extra spaces
	when calling equip - AMX2D.
	--]]--
	function trim(t) return t end
end
--###################################--
--############# equip() #############--
--###################################--
local _equip = equip -- Preparing to overload function equip.
function equip(p, w, noConflict)
	--If used as equip(player, wpn), then return the normal version.
	if not noConflict then return _equip(p, w) end
	--[[--
	Checks if w is a string, if it is, converts it to the
	wpntype equivalent. Then it checks if the wpntype ID exists.
	**Note:**
	Must have AMX2D loaded to have this feature on, else you
	must use WeaponType instead of a string.
	--]]--
	if amx2d then
		if type(w) == "string" then
			if wpn.id[trim(w)] then
				w = wpn.id[trim(w)]
			else return
			end
		end
	end
	if not wpn[tonumber(w)] then return end
	--[[--
	This creates a list of all of the current weapons and
	strips them from the player, then gives him back the
	Knife.
	--]]--
	local _pwpn = {slot={}, oldslot = {}}
	local slot = function(_wpn)
		if (_wpn<=40 and _wpn>=10) or (_wpn<=49 and _wpn>=45) then
			--Primary Weapon - Slot 1
			return 1
		elseif (_wpn < 10) then
			--Secondary Weapon - Slot 2
			return 2
		elseif (_wpn == Knife or _wpn == Machete or _wpn == Wrench or _wpn == Claw or _wpn == Chainsaw) then
			--Melee - Slot 3
			return 3
		elseif (_wpn < 55 and _wpn > 50) then
			--Grenades - Slot 4
			return 4
		else
			--Slotless
			return 0
		end
	end
	while not (player(p, "weapontype") == 0) do
		local _wpn = player(p, "weapontype")
		_pwpn.oldslot[slot(_wpn)] = _wpn
		_pwpn.slot[slot(_wpn)] = _wpn
		_pwpn[_wpn] = _wpn -- In case we need to call _pwpn[wpntyp] to see if it exists.
		strip(p, _wpn)
	end
	equip(p, Knife)
	--Slot 1 or 2 should strip these weapons.
	if (slot(w) == 1) or (slot(w)==2) then
		if _pwpn.slot[slot(w)] then
			strip(p, _pwpn.slot[slot(w)])
			_pwpn.slot[slot(w)] = w
		end
	end
	--[[--
	Iterates through all of the slots of the new weapon table and
	equips them using equip (which we do not pass in the last boolean
	and thus will not do a full recusion)
	--]]--
	for k, v in pairs (_pwpn.slot) do
		--Will Re-equip everything, including Knife again.
		equip(p, v)
	end
	return _pwpn -- Returns the old and current slot listing.
end
BeliioN has written
Hmm.. Kann mir einer Helfen möchte dass man einen Befehl nur an einen Bestimmten Ort benutzen kann.. geht das?
Ist wichtig
und bei gungame musst du dann die zeilen
1
2
2
-- Strip Knife
			parse("strip "..i.." 50")
das HE , und Knife Letzte Waffen sind . Und noch wie ist das mit dem Stole Kill? Geht das auch? 1
2
2
-- Weapons for differen Levels
sample.gg.wpn={35,48,49,30,38,20,21,10,4,50}
kannst hier für jedes level die waffe einsetzen.
standard ist
1. waffe = 35
2. waffe = 48
usw.
musst nur verändern
EDIT:
kann mir jemand sagen wie ich es schaffe Ts und CTs zu vertauschen?
für wann des Spiel aufhört ich will wissen wann das dann noch auf hört :D.Gamemode weiß ich wie man changt aber rest kA!
guck mal in sfx/fun/ ob du alle sounds hast
weiß nicht warum
vllt ist etwas am script falsch
EDIT: bei fun habe ich alle sounds
da sind ganz viele... ich glaube der heißt irgendwas mit utsounds oder so
also bei mir ist nur utsfx.lua sontz nix.
dann habe ich es versucht so:
dofile("/sys/lua/samples/utsfx")
und bei new games unter more settings lua utsfx.lua eingegeben und nix passiert alles normal also ich versteh das net ist das ne bug oder mache ich was falsch ich habe alles gemacht was tkd mir gesagt hat und leiche auch aber geht net.
@PanDa:
meinst du etwa
1
parse("speedmod "..i.." GESCHWINDIGKEIT")
Sammelthread/FAQ zu Lua & Editor


Offline