local SWATteam = {}

function SWATteam.tick()
	local playerPed = PLAYER.PLAYER_PED_ID()
	local player = PLAYER.GET_PLAYER_PED(playerPed)
	local playerExists = ENTITY.DOES_ENTITY_EXIST(playerPed)
	if(PLAYER.IS_PLAYER_ONLINE() and playerExists) then
		if(get_key_pressed(114)) then
			local veh = PED.GET_VEHICLE_PED_IS_IN(playerPed,true)
			local SWATskinID = GAMEPLAY.GET_HASH_KEY("s_m_y_swat_01")
			local coords = ENTITY.GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(playerPed, 0.0, 5.0, 0.0);
			STREAMING.REQUEST_MODEL(SWATskinID)
			local SWAT = PED.CREATE_PED( 26,SWATskinID,coords.x, coords.y, coords.z,0,false,true)
			local group = PLAYER.GET_PLAYER_GROUP(PLAYER.PLAYER_ID());
			PED.SET_PED_AS_GROUP_MEMBER(SWAT, group);
			AI.TASK_COMBAT_HATED_TARGETS_AROUND_PED(SWAT, 5000, 0);
			PED.SET_PED_KEEP_TASK(SWAT, true);
			WEAPON.GIVE_DELAYED_WEAPON_TO_PED(SWAT, GAMEPLAY.GET_HASH_KEY("weapon_specialcarbine"), 5, true);
			ENTITY.SET_ENTITY_INVINCIBLE(SWAT, false);
			
		end
				
				
				
				
				
				
	end
end

return SWATteam