rawset(_G, "PTAIinit", function(p)
	p.ptaiinit = 1
	p.ptaiframewait = 0
	p.ptaicolor = 1
	p.ptaicanai = 0
	p.ptaispecialskin = 0
//	p.ptaistyle = 1,
//	p.ptaispeed = 0,
	//we dont actually set these, but its easier to keep track of vars
/*	p.ptaicolor1
	p.ptaicolor2
	
*/	CONS_Printf(p, "Pizza Tower Variables set.")
	CONS_Printf(p, "\x82"+"Check out"+"\x86"+" ptafterimageshelp"+"\x82 "+"for options!")

	return true
end)

//pretty much just soap_cos_speedometer
COM_AddCommand("ptafterimageshelp", function(p)
	if not p or not p.ptaiinit or not p.valid
        CONS_Printf(p, "\x85"+"You aren't valid or the Pizza Tower Variables aren't!")
        return
	end
	
	CONS_Printf(p, "PT Afterframes has 4 commands available for you to tinker around with, which are saved automatically!")
	CONS_Printf(p, "\x86ptafterimagesstyle -\x82 Sets the style of the afterimages.")
	CONS_Printf(p, "\x86ptafterimagesactive -\x82 Sets the activation method of the afterimages.")
	CONS_Printf(p, "\x86ptafterimagescolor1 -\x82 Sets the color of the first afterimage. Can only be viewed if your style is set to 3.")
	CONS_Printf(p, "\x86ptafterimagescolor2 -\x82 Sets the color of the second afterimage. Can only be viewed if your style is set to 3.")
	
end)

COM_AddCommand("ptafterimagesstyle", function(p, arg)
	if not p or not p.valid
        CONS_Printf(p, "\x85"+"You don't exist yet!")
        return
	end
	
	local prevstyle
	local argV
	
	if arg
		argV = tonumber(arg)
		prevstyle = p.ptaistyle
		p.ptaistyle = argV
		if not argV
		or argV > 3
		or argV < 1
			p.ptaistyle = prevstyle
			CONS_Printf(p, "\x85"+"Value is too low! Choose between 1 or 3.")
			return
		end
		if io and p == consoleplayer
			local file = io.openlocal("client/pizzatowerai/style.dat", "w+")
			file:write(argV)
			file:close()
		end

		CONS_Printf(p, "Style set to "+"\x82"+arg+"\x80"+".")
	else
		CONS_Printf(p, "Changes the colors of the Pizza Tower Afterimages.")
		CONS_Printf(p, "This has 3 styles available:")
		CONS_Printf(p, "1: Pizza Tower") 
		CONS_Printf(p, "2: Sugary Spire")
		CONS_Printf(p, "3: Custom")
		CONS_Printf(p, "Current style is \x82" + p.ptaistyle+"\x80"+".") 
	end
end)

COM_AddCommand("ptafterimagesactive", function(p, arg)
	if not p  or not p.valid
        CONS_Printf(p, "\x85"+"You don't exist yet!")
        return
	end
	
	local prevstyle
	local argV
	
	if arg
		argV = tonumber(arg)
		prevstyle = p.ptaispeed
		p.ptaispeed = argV
		if (arg == nil)
		or argV > 1
		or argV < 0
			p.ptaispeed = prevstyle
			CONS_Printf(p, "\x85"+"Value is too low! Choose either 0 or 1.")
			return
		end
		if io and p == consoleplayer
			local file = io.openlocal("client/pizzatowerai/activation.dat", "w+")
			file:write(argV)
			file:close()
		end

		CONS_Printf(p, "Style set to "+"\x82"+argV+"\x80"+".")
	else
		CONS_Printf(p, "Sets what makes afterimages.")
		CONS_Printf(p, "This has 2 styles available:")
		CONS_Printf(p, "0: Default (Shoes and Dashmode only)") 
		CONS_Printf(p, "1: Speed (Shoes, Dashmode and speed)")
		CONS_Printf(p, "Current style is \x82" + p.ptaispeed+"\x80"+".") 
	end
end)

COM_AddCommand("ptafterimagescolor1", function(p, arg, s)
	if not p or not p.valid
        CONS_Printf(p, "\x85"+"You don't exist yet!")
        return
	end
	
	local prevstyle
	local c
	
	if p.ptaistyle ~= 3
	and not s
		CONS_Printf(p, "\x8D"+"These can only be viewed if you have your style set to "+"\x82"+"Custom"+"\x8D"+".\n")
	end
	
	if arg and R_GetColorByName(arg) != SKINCOLOR_NONE
		c = R_GetColorByName(arg)
		prevstyle = p.ptaicolor1
		p.ptaicolor1 = c
		if (arg == nil)
			p.ptaicolor1 = prevstyle
			if not s
				CONS_Printf(p, "\x85"+"You have to set a color for this to work.")
			end
			return
		end
		if io and p == consoleplayer
			local file = io.openlocal("client/pizzatowerai/color1.dat", "w+")
			file:write(c)
			file:close()
		end

		if not s
			CONS_Printf(p, "First Color set to "+"\x82"+arg+"\x80"+".")
		end
	else
		CONS_Printf(p, "Sets what color the first afterimage is.")
		CONS_Printf(p, "Please note that custom colors may not save!\n")
		CONS_Printf(p, "Current color is \x82" + p.ptaicolor1+"\x80"+".") 
	end
end)

COM_AddCommand("ptafterimagescolor2", function(p, arg, s)
	if not p or not p.valid
        CONS_Printf(p, "\x85"+"You don't exist yet!")
        return
	end
	
	local prevstyle
	local c
	
	if p.ptaistyle ~= 3
	and not s
		CONS_Printf(p, "\x8D"+"These can only be viewed if you have your style set to "+"\x82"+"Custom"+"\x8D"+".\n")
	end
	
	if arg and R_GetColorByName(arg) != SKINCOLOR_NONE
		c = R_GetColorByName(arg)
		prevstyle = p.ptaicolor2
		p.ptaicolor2 = c
		if (arg == nil)
			p.ptaicolor2 = prevstyle
			if not s
				CONS_Printf(p, "\x85"+"You have to set a color for this to work.")
			end
			return
		end
		if io and p == consoleplayer
			local file = io.openlocal("client/pizzatowerai/color2.dat", "w+")
			file:write(c)
			file:close()
		end

		if not s
			CONS_Printf(p, "Second Color set to "+"\x82"+arg+"\x80"+".")
		end
	else
		CONS_Printf(p, "Sets what color the second afterimage is.")
		CONS_Printf(p, "Please note that custom colors may not save!\n")
		CONS_Printf(p, "Current color is \x82" + p.ptaicolor2+"\x80"+".") 
	end
end)


freeslot("SKINCOLOR_AIREALLYRED")
freeslot("SKINCOLOR_AIREALLYGREEN")
//spaces added to the end of the top 2's names to avoid conflicts
//with soaps afterimages colors
freeslot("SKINCOLOR_AIREALLYBLUE")
freeslot("SKINCOLOR_AIREALLYPINK")

skincolors[SKINCOLOR_AIREALLYRED] = {
    name = "Really Red ",
    ramp = {35,35,35,35,35,35,35,35,35,35,35,41,41,41,41,41},
    invcolor = SKINCOLOR_AIREALLYGREEN,
    invshade = 0,
    chatcolor = V_REDMAP,
    accessible = true
}
//freeslot("SKINCOLOR_SOAPAIREALLYGREEN")

skincolors[SKINCOLOR_AIREALLYGREEN] = {
    name = "Really Green ",
    ramp = {100,100,100,100,100,100,100,100,100,100,100,191,191,191,191,191},
    invcolor = SKINCOLOR_AIREALLYRED,
    invshade = 0,
    chatcolor = V_GREENMAP,
    accessible = true
}

skincolors[SKINCOLOR_AIREALLYBLUE] = {
    name = "Really Blue",
    ramp = {136,136,136,136,136,136,136,136,136,136,136,138,138,138,138,138},
    invcolor = SKINCOLOR_AIREALLYPINK,
    invshade = 0,
    chatcolor = V_SKYMAP,
    accessible = true
}

skincolors[SKINCOLOR_AIREALLYPINK] = {
    name = "Really Pink",
    ramp = {204,204,204,204,204,204,204,204,204,204,204,71,71,71,71,71},
    invcolor = SKINCOLOR_AIREALLYBLUE,
    invshade = 0,
    chatcolor = V_ROSYMAP,
    accessible = true
}