
Currently I'm reseeding math.random using os.time everytime my function is called. Is this necessary?
addhook("use","player_use") function player_use(id,trigger) 	if(trigger=="339") then 		parse("equip "..id.." 1")end 	if(trigger=="337") then 		parse("equip "..id.." 2")end 	if(trigger=="338") then 		parse("equip "..id.." 3")end 	end end
addhook("use","player_use_weapon") function player_use_weapon(id, type_, _, x, y) 	if type_ ~= 100 then return end 	trigger = entity(x, y, "name") 	hash = { 		["339"] = 1, 		["337"] = 2, 		["338"] = 3, 		-- Add in additional entries here if necessary. 	} -- For a better level of abstraction that decreases code redundancy 	local equip = "equip %s %s" 	if hash[trigger] then 		parse(equip:format(trigger, hash[trigger])) 	end end
addhook("use","player_use_weapon") function player_use_weapon(id, type_, _, x, y) if type_ ~= 100 then return end trigger = entity(x, y, "name") hash = { ["339"] = 1, ["337"] = 2, ["338"] = 3, -- Add in additional entries here if necessary. } -- For a better level of abstraction that decreases code redundancy local equip = "equip %s %s" if hash[trigger] then parse(equip:format(trigger, hash[trigger])) end end
addhook("endround","playsound") function playsound(mode) if mode==1 or mode==50 or mode==40 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2.wav\"") elseif mode==2 or mode==51 or mode==41 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1.wav\"") end end
addhook("endround","playsound") function playsound(mode) if mode==1 or mode==50 or mode==40 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2.wav\"") elseif mode==2 or mode==51 or mode==41 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1.wav\"") end end
addhook("endround","playsound") function playsound(mode) if mode==1 or mode==50 or mode==40 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2.wav\"") elseif mode==2 or mode==51 or mode==41 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1.wav\"") end end
addhook("endround","playsound") sound1 = 0 sound2 = 0 function playsound(mode) if mode==1 or mode==50 or mode==40 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2."..sound2..".wav\"") 		sound2 = sound2 + 1 		if (sound2 == 3) then sound2 = 0 end elseif mode==2 or mode==51 or mode==41 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1."..sound1..".wav\"") 		sound1 = sound1 + 1 		if (sound1 == 3) then sound1 = 0 end end end
os.date("*t") -- Returns the following table --[[-- { 	year = 2010, 	month = 10, 	day = 19, 	hour = 14, 	min = 28, 	sec = 16, 	wday = 3, -- Day of Week 	yday = 292, -- Day of the year (out of 365) 	isdst = true -- Are we in Daylight Saving time } So you can do something like print(os.date("*t").year) --]]--
LUA ERROR: sys/lua/endround.lua:8: malformed number near '4FUN'
addhook("endround","playsound") sound1 = 0 sound2 = 0 function playsound(mode) if mode==1 or mode==50 or mode==40 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2."CoN_(FFA)(4FUN)/ct20".wav\"") sound2 = sound2 + 1 if (sound2 == 3) then sound2 = 0 end elseif mode==2 or mode==51 or mode==41 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1."CoN_(FFA)(4FUN)/nrs2".wav\"") sound1 = sound1 + 1 if (sound1 == 3) then sound1 = 0 end end end
LUA ERROR: sys/lua/endround.lua:8: malformed number near '4FUN'
addhook("endround","playsound") sound1 = 0 sound2 = 0 function playsound(mode) if mode==1 or mode==50 or mode==40 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2."CoN_(FFA)(4FUN)/ct20".wav\"") sound2 = sound2 + 1 if (sound2 == 3) then sound2 = 0 end elseif mode==2 or mode==51 or mode==41 then parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1."CoN_(FFA)(4FUN)/nrs2".wav\"") sound1 = sound1 + 1 if (sound1 == 3) then sound1 = 0 end end end
addhook("endround","playsound") sound1 = 0 sound2 = 0 function playsound(m) 	if m==1 or 40 or 50 then 		parse("sv_sound \"CoN_(FFA)(4FUN)/zxc2.CoN_(FFA)(4FUN)/ct20.wav\"") 			sound2 = sound2 + 1 		if (sound2 == 3) then sound2 = 0 end 	elseif m==2 or 41 or 51 then 		parse("sv_sound \"CoN_(FFA)(4FUN)/zxc1.CoN_(FFA)(4FUN)/nrs2.wav\"") 			sound1 = sound1 + 1 		if (sound1 == 3) then sound1 = 0 end 	end end
- image("path",x,y,mode,[pl])	Creates an image (dynamic object) on the map and returns the ID. 				Mode 0: floor image (covered by players etc) 				Mode 1: top image (covering players) 				Mode 2: HUD image (covering everything, part of the interface) 				Mode 3: super top image (covering everything on the map) 				Mode 101-132: draw under this player (id+100) 				Mode 201-232: draw over this player (id+200) 				Mode 133-164: draw over this player and over entities (id+132) 				When drawing at player, x and y are used this way: 				x<=0: do not rotate with player, x>0: rotate img with player 				y<=0: only draw if not covered by fog of war, y>0: draw always 				[pl] is an optional parameter. 0 (default value) means that 				all players see this image. If you set it to a player ID then 				only this player will see this image! 				The command returns the ID of the dynamic object image!