you had one right if - end - construct there which is:
1
2
3
2
3
if (txt=="!deagle") then
	parse("equip "..id.." 3")
end
thinking should help.
edited 2×, last 17.04.09 11:47:30 pm
 
 
Scripts 
 Lua Scripts/Questions/Helpif (txt=="!deagle") then
	parse("equip "..id.." 3")
end
addhook("say","player_say")
function player_say(id,txt)
	if(txt=="!usp") then
		parse("equip "..id.." 1")
	elseif(txt=="!glock") then
		parse("equip "..id.." 2")
	elseif(txt=="!deagle") then
		parse("equip "..id.." 3")
	end
end
 addhook("say","player_say")
function player_say(id,txt)
	if(txt=="!usp") then
		parse("equip "..id.." 1") end
	if(txt=="!glock") then
		parse("equip "..id.." 2") end
	if(txt=="!deagle") then
		parse("equip "..id.." 3") end
end

dofile("sys/lua/wpnids.lua")
addhook("say", "player_say")
function player_say(p, t)
	local delim = "!"
	if string.sub(t, 1. #delim) == delim then
		local cmd = string.sub(t, #delim)
		if type(_G[cmd]) == "number" then
			parse(string.format("equip %s %s", p, _G[cmd]))
		end
	end
end
  addhook("say","player_say") 
function player_say(id,txt) 
    
          if(txt=="!all_wep") then 
          lol=0
          while(lol<=100) do
             parse("equip "..id.." "..lol) 
             parse("say you just got all weps") 
             parse("sv_sound \"Soundfile\"")
           lol=lol+1
   
 end end  end
 addhook("say","player_say")
function player_say(id,txt)
	if(txt=="!all_wep") then
		lol=0
		while(lol<=100) do
			parse("equip "..id.." "..lol)
			parse("say you just got all weps")
			parse("sv_sound \"Soundfile\"")
			lol=lol+1
		end
	end
end
 use if (itemtype(lol,"name")~="") then to check if this item exists (=has a name) before you try to assign it.
 careful! remove the say and sound commands from the loop! otherwise they will be executed 101 times! this is a very critical error which also causes massive traffic (it could also kill the server in worst case)! execute them before or after the loop!
 use for lol = 1,100 do instead of the while loop. so you don't need the lol=lol+1!
 I recommend to use msg instead of say. if flacko==nil then flacko={} end
flacko.heroes={}
-------------------
--FUNCTIONS--
-------------------
function initArray(m,F)
	local array = {}
	for i = 1, m do
		array[i]=F
	end
	return array
end
function flacko.heroes.setclass(id,hp,armor,speed)
	parse("setmaxhealth "..id.." "..hp)
	parse("setarmor "..id.." "..armor)
	parse("speedmod "..id.." "..speed)
end
function hudtext2(id,tid,color,txt,x,y)
	toprint = ("©"..color.." "..txt)
	parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y)
	--PARAMETERS: 1-Player ID| 2-Text ID| 3-COLOR| 4-TEXT| 5/6-POSITION|
end
function flacko.heroes.classmenu(id)
	if(flacko.heroes.commanders==0) then
		menu(id,"Select your Class,War Machine,Ninja,Calibur,Bomber,Sniper,Engineer,Commander")
	elseif(flacko.heroes.commanders==1) then
		menu(id,"Select your Class,War Machine,Ninja,Calibur,Bomber,Sniper,Engineer")
	end
end
--------------------------------------
--Some variables and tables--
--declarations over here      --
--------------------------------------
flacko.heroes.class=initArray(32,0)
flacko.heroes.specitemtimer = 0
flacko.heroes.specitems=initArray(32,0)
flacko.heroes.limit = 15
flacko.heroes.commanders = 0
parse("mp_randomspawn 1")
parse("sv_gamemode 4")
------------------------
-- TEAM -> CLASS--
------------------------
addhook("team","flacko.heroes.team")
function flacko.heroes.team(id,team)
	if (team==2) then
		flacko.heroes.classmenu(id)
	end
end
-----------------------
--SERVERACTION--
-----------------------
addhook("serveraction","flacko.heroes.serveraction")
function flacko.heroes.serveraction(id)
	flacko.heroes.classmenu(id)
end
--I don't know what is this for, but i left it from the original classes code
---------------------------
--CLASS SELECTION--
---------------------------
addhook("menu","flacko.heroes.menu")
function flacko.heroes.menu(id,menu,sel)
	if (menu=="Select your Class") then
		if (sel>=0 and sel<=7) then
			flacko.heroes.class[id]=sel
			if (player(id,"health")>0) then
				parse("killplayer "..id)
			end
		end
	end
end
-----------------------
-- SPAWN           --
-----------------------
addhook("spawn","flacko.heroes.spawn")
function flacko.heroes.spawn(id)
	local weaponstring
	
	hudtext2(id,1,"","",0,0) --Clears HUD texts
	if(player(id,"team")==2) then
		
		if(flacko.heroes.class[id]==0) then
			flacko.heroes.class[id]=math.random(1,6)
		end
		
		if(flacko.heroes.class[id]==1) then
			flacko.heroes.setclass(id,120,203,0)
			weaponstring = "40,48,76"
		elseif(flacko.heroes.class[id]==2) then
			flacko.heroes.setclass(id,85,206,35)
			weaponstring = "69"
			hudtext2(id,1,"000255000","Special items: "..flacko.heroes.specitems[id],250,420)
			--Ninjas drop mines
		elseif(flacko.heroes.class[id]==3) then
			flacko.heroes.setclass(id,90,201,0)
			weaponstring = "30,10"
			hudtext2(id,1,"000255000","Special items: "..flacko.heroes.specitems[id],250,420)
			--Calibur drops primmary ammo
		elseif(flacko.heroes.class[id]==4) then
			flacko.heroes.setclass(id,60,0,5)
			weaponstring = "49,51,76,72"
		elseif(flacko.heroes.class[id]==5) then
			flacko.heroes.setclass(id,85,204,-5)
			weaponstring = "35,53,59"
			hudtext2(id,1,"000255000","Special items: "..flacko.heroes.specitems[id],250,420)
			--Sniper drops medikits
		elseif(flacko.heroes.class[id]==6) then
			flacko.heroes.setclass(id,100,204,7)
			weaponstring = "11,74"
		elseif(flacko.heroes.class[id]==7) then
			flacko.heroes.setclass(id,150,203,10)
			flacko.heroes.commanders = 1
			weaponstring = "32,11,36,69"
		end
	
	end
	return weaponstring;
end
-----------------------
-- NO BUYING     --
-----------------------
addhook("buy","flacko.heroes.buy")
function flacko.heroes.buy()
	return 1
end
-------------------------
--NO COLLECTING--
-------------------------
addhook("walkover","flacko.heroes.walkover")
function flacko.heroes.walkover(id,iid,type)
	if (type>=61 and type<=68) or (type==77) or (type>=70 and type<=71) then
		return 0
	end
	return 1
end
-----------------------
-- NO DROPPING--
-----------------------
addhook("drop","flacko.heroes.drop")
function flacko.heroes.drop(id)
	if(player(id,"team")==2) then
		if(flacko.heroes.specitems[id]>=1) then
			if(flacko.heroes.class[id]==5) then --Snipers drop Medikits
				flacko.heroes.specitems[id] = flacko.heroes.specitems[id]-1
				hudtext2(id,1,"000255000","Special items: "..flacko.heroes.specitems[id],250,420)
				parse("spawnitem 64 "..player(id,"tilex").." "..player(id,"tiley"))
			elseif(flacko.heroes.class[id]==3) then --Caliburs drop primmary ammo
				flacko.heroes.specitems[id] = flacko.heroes.specitems[id]-1
				parse("spawnitem 61 "..player(id,"tilex").." "..player(id,"tiley"))
				hudtext2(id,1,"000255000","Special items: "..flacko.heroes.specitems[id],250,420)
			elseif(flacko.heroes.class[id]==2) then --Ninjas drop mines
				flacko.heroes.specitems[id] = flacko.heroes.specitems[id]-1
				parse("spawnitem 77 "..player(id,"tilex").." "..player(id,"tiley"))
				hudtext2(id,1,"000255000","Special items: "..flacko.heroes.specitems[id],250,420)
			end
		end
	end
	return 1
end
------------------------------
--NO DEAD DROPPING--
------------------------------
addhook("die","flacko.heroes.die")
function flacko.heroes.die(id)
	if(flacko.heroes.class[id]==7) then
		flacko.heroes.commanders = 0
		flacko.heroes.class[id] = math.random(1,6)
	end
	return 1
end
-------------------------------
--SPECIAL ITEM TIMER --
-------------------------------
addhook("second","flacko.heroes.second")
function flacko.heroes.second()
	flacko.heroes.specitemtimer = flacko.heroes.specitemtimer+1
	if(flacko.heroes.specitemtimer>=flacko.heroes.limit) then
		flacko.heroes.specitemtimer = 0
		for id=1, 32 do
			if(player(id,"exists")) then
				if(flacko.heroes.class[id]==5 or flacko.heroes.class[id]==3 or flacko.heroes.class[id]==2) then
					flacko.heroes.specitems[id]=flacko.heroes.specitems[id]+1
					hudtext2(id,1,"000255000","Special items: "..flacko.heroes.specitems[id],250,420)
				end
			end
		end
	end
end
-----------------------
--   ON JOINING  --
-----------------------
addhook("join","flacko.heroes.join")
function flacko.heroes.join(id)
	flacko.heroes.specitems[id]=0
	flacko.heroes.class[id]=0
end
  --AMX2D Already has this built in.
if amx2d then return true end
function string.trim(t)
	t = string.split(t)
	s = ""
	if not t then return end
	for i, v in ipairs(t) do
		s = s.." "..v
	end
	s = string.sub(s, 2)
	return s
end
function string.split(t, b)
	local cmd = {}
	local match = "[^%s]+"
	if b then
		match = "%w+"
	end
	if type(b) == "string" then match = "[^"..b.."]+" end
	if not t then return nil end
	for word in string.gmatch(t, match) do
		table.insert(cmd, word)
	end
	return cmd
end
function string.inside(o, t)
	for i, v in ipairs(t) do
		if o==v then return true end
	end
end
function string.qsplit(t, d)
	if not d then d = '"' end
	local tab = string.split(t, d)
	if #tab == 1 then
		return string.split(tab[1])
	end
	local ret = {}
	for i, v in ipairs(tab) do
		if i%2 ~= 0 then
			table.insert(ret, v)
		else
			v = string.split(v)
			for _i, _v in ipairs(v) do
				table.insert(ret, _v)
			end
		end
	end
	return ret
end
function table.trim(t)
	local tab = {}
	for k, v in pairs(t) do
		if type(k) == "string" then k = k:trim() end
		if type(v) == "string" then v = v:trim() end
		tab[k] = v
	end
	return tab
end
function table.toStr(t, n, d)
	local s = ""
	if (n == nil) then n = 1 end
	if n<1 then n = 1 end
	if not d then d = " " end
	while (n <= #t) do
		s = s .. t[n] .. "".. d
		n = n + 1
	end
	return s
end
function isplayer(p)
	p = playerid(p)
	if not (type(p) == "number") then return false end
	if not player(p, "exists") then return false end
	return true
end
function playerid(i)
	i = string.trim(i)
	if tonumber(i) then
		if player(tonumber(i), "exists") then return tonumber(i) end
	end
	i = name2id(i)
	return i
end
function name2id(name)
	local names = {}
     for i =1, 32, 1 do
          if player(i, "exists") then
               names[player(i, "name")] = i
			end
     end
     if names[name] then return names[name] else return nil end
end
function id(name)
	return name2id(name)
end
function id2name(id)
	if player(id, "exists") then
		return player(id, "name")
	end
end
function name(id)
	return id2name(id)
end
if not player then
	function player(p, n)
		return n
	end
end
function args(t, n)
	if #t < 1 then return end
	if not n then n = #t:split() end
	local arg = {}
	if type(n) == "table" then
		arg = n
		n = #n
	elseif type(n) == "string" then
		arg = table.trim(string.split(n, ","))
		n = #arg
	end
	local t = t:split()
	local _t = {}
	if #t < n then n = #t end
	for i = 1, n-1 do
		local x = t[i]
		if #arg > 0 then
			if arg[i]:split("_") then
				if arg[i]:split("_")[2] == "id" then
					x = playerid(x)
					arg[i] = arg[i]:split("_")[1]
				end
			end
		end
		if not x then x = t[i] end
		if tonumber(x) then x = tonumber(x) end
		x = string.trim(x)
		if #arg > 0 then
			_t[arg[i]] = x
		end
		table.insert(_t, string.trim(t[i]))
	end
	local last = table.toStr(t, n)
	if #last == 0 then last = nil end
	local _l = last
	if #arg > 0 then
		if arg[n]:split("_") then
			if arg[n]:split("_")[1] == "id" then l = playerid(last) end
		end
	end
	if l then last = l end
	if tonumber(last) then last = tonumber(last) end
	last = string.trim(last)
	if #arg > 0 then
		_t[arg[n]] = last
	end
	table.insert(_t, string.trim(table.toStr(t, n)))
	return _t
end
t=args("guns name AK47", "cmd, player_id, gun")
print(t.cmd, t.player, t.gun)
addhook("join","sample.ads.join")
function sample.ads.join(p,t)
	msg2(p,"Welcome on my Server, "..player(p,"name").."!")
end
function sample.ads.join(p,t)
function lol(1,2,3)
function lol(1,3)
function lol(1,2)
function initArray(m)
	local array = {}
	for i = 1, m do
		array[i]=0
	end
	return array