For kill, the player automatically receive 1 Hat and the other killing another hat.
What is script for this?
edited 4×, last 06.04.16 02:02:18 am
-- Create a table that holds player hat images local p = {} -- A function to remove a player's hat image function freehatimage(i) 	-- If this player (i) has any hat image 	if (p[i]) then 		-- Remove the hat image from this player (i) 		freeimage(p[i]) 		 		-- Set the element's value to nil for no image 		p[i] = nil 	end end -- A function to add hat image to a player function addhatimage(i) 	-- If this player (i) does not have any hat image 	if (not p[i]) then 		-- Put a hat image on this player (i) 		p[i] = image("to/your/hat.png", 1, 0, i + 200) 	end end -- When every start of round function startroundhook(m) 	-- Iterate through all players (32 players) 	for i = 1, 32 do 		freehatimage(i) 	end end -- Add hook for kill & startround addhook("kill", "addhatimage") addhook("startround", "startroundhook") -- Add hook for die & leave for i, v in ipairs({"die", "leave"}) do 	addhook(v, "freehatimage") end
freeimage(image) image = nil
if (image1) then freeimage(image1) image1 = nil end if (image2) then freeimage(image2) image2 = nil end etc..
imageId = freeimage(imageId)
local f = freeimage function freeimage(i) f(i) return nil end